Search code examples
phpmysqlsqldrupal-7

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.


Solution

  • 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!)