excluded excluded - 1 year ago 53
MySQL Question

Can't update row in database

I try to update a row in a database, but I can't do that. Here is my sql:

$sql = "UPDATE `voting_nomination_counter`
SET `quantity`=quantity+1
WHERE `nid` = '$nid'
AND nominee = '$nominee'";

I suspect the problem is here -
AND nominee = '$nominee'";
because when I remove this from the query all works and updates fine. Help, please.

Answer Source

I solve this problem, if I want to update WHERE string = string I just need to use this statement UPDATE table SET field = REPLACE(field, 'string', 'anothervalue') WHERE field LIKE '%string%';, thanks guys!)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download