MasterACE14 Posted February 29, 2008 Share Posted February 29, 2008 Evening PHP Freaks, I am having some trouble with my MySQL Query, it has been working fine, but when I had to add something new to the WHERE part of the query, it is now spitting out errors. any help is greatly appreciated! query: <?php $sqlzx = "UPDATE `cf_users`,`cf_users2` SET `cf_users`.`money`= `cf_users`.`money`+ `cf_users2`.`amount_supplydrop`*`cf_users2`.`amount_supplysize` WHERE cf_users.id = cf_users2.id , `cf_users`.`current_health` > 0"; // execute the query $rs = mysql_query( $sqlzx ) or die('Query:<br />' . $sqlzx . '<br /><br />Error:<br />' . mysql_error()); ?> The trouble part is where I have `current_health` here's the output I'm getting: Query: UPDATE `cf_users`,`cf_users2` SET `cf_users`.`money`= `cf_users`.`money`+ `cf_users2`.`amount_supplydrop`*`cf_users2`.`amount_supplysize` WHERE cf_users.id = cf_users2.id , `cf_users`.`current_health` > 0 Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' `cf_users`.`current_health` > 0' at line 1 Regards ACE Link to comment https://forums.phpfreaks.com/topic/93652-mysql-query-problem-update-trouble-at-where-claus/ Share on other sites More sharing options...
trq Posted February 29, 2008 Share Posted February 29, 2008 Yeah, you probably ought to check the valid syntax for a WHERE prior to guessing at stuff. WHERE cf_users.id = cf_users2.id && cf_users.current_health > 0 Link to comment https://forums.phpfreaks.com/topic/93652-mysql-query-problem-update-trouble-at-where-claus/#findComment-479827 Share on other sites More sharing options...
MasterACE14 Posted February 29, 2008 Author Share Posted February 29, 2008 yep, that works now, Thankyou thorpe edit: has the Topic solved button been removed?? Regards ACE Link to comment https://forums.phpfreaks.com/topic/93652-mysql-query-problem-update-trouble-at-where-claus/#findComment-479841 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.