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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is wrong with this UPDATE command??

Status
Not open for further replies.

TheDust

Programmer
Aug 12, 2002
217
0
0
US
UPDATE a_albums SET ratingPts = (ratingPts + $formRating), ratingNum = (ratingNum + 1) WHERE albumID = $formAlbumID;

I'm trying to increase the values of two columns in "a_albums"... ratingPts gets increased by a variable returned from the user, and ratingNum gets increased by 1. Anybody know what I'm doing wrong here? Everything looks right... ?
 
everything looks okay, except maybe the parentheses, not sure about those, you could take them out

otherwise, make your your variables are actual numeric values...


rudy
 
You didn't actually say what problem you were seeing with your UPDATE statment. Syntax itself looks OK. I assume that the statement is surrounded by double quotes " and not single quotes '. Does the record get updated at all? Any mySql error messages? Does $formAlbumID contain what you think it contains? I noticed that it isn't quoted, is it a numberic value? If not you will need to quote it.

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top