Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mySQL query problem

Status
Not open for further replies.
Aug 28, 2005
6
HR
Hello, first time poster here ;)

I have an query that just increases some values in a table, and I perfer to do it in the query itself (and not by reading the vaules before).

The query is:
mysql_query("UPDATE galerije SET ocjena_glasova = ocjena_glasova+1 AND ocjena_ukupno = ocjena_ukupno+'$ocjena' WHERE id_rada = '$id'") or die(mysql_error());

And it will not work :(
No errors returned, nothing, the vaules remain the same (field s are bigINT).

Thanks in advance!
 
Do you mean you want to change the values of ocjena_glasova and ocjena_ukupno? In that case, you could use:
[tt]
UPDATE galerije
SET
ocjena_glasova = ocjena_glasova+1,
ocjena_ukupno = ocjena_ukupno+'$ocjena'
WHERE id_rada = '$id'

However, if you want to do a string concatentaion of ocjena_ukupno and $ocjena, you would use instead: [tt]
ocjena_ukupno = CONCAT(ocjena_ukupno,'$ocjena')
[/tt]
 
Just to increase the values, the first case.

Thank you very, very much, it would take me until mySQL ver. 8 came to figure this out :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top