Dethman Posted July 22, 2008 Share Posted July 22, 2008 hey I am getting this error: Deposit SQL 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 'WHERE `userid` ='1'' at line 1 from this line: <?php $query_1="INSERT INTO `user_users` SET `credits` = `credits` -'{$amt}', `vault` = `vault` +'{$tax_amt}' WHERE `userid` ='{$id}'"; $query_mysql=mysql_query($query_1) or die("Deposit SQL ERROR: ".mysql_error()); ?> Link to comment https://forums.phpfreaks.com/topic/116000-mysql_query-error/ Share on other sites More sharing options...
unkwntech Posted July 22, 2008 Share Posted July 22, 2008 I dont see any error but try this: <?php $query_1="INSERT INTO `user_users` SET `credits` = `credits` -'" . $amt . "', `vault` = `vault` +'" . $tax_amt . "' WHERE `userid` = '" . $id . "'"; echo $query_1; ?> and dubble check that the query looks good. Link to comment https://forums.phpfreaks.com/topic/116000-mysql_query-error/#findComment-596407 Share on other sites More sharing options...
MasterACE14 Posted July 22, 2008 Share Posted July 22, 2008 WHERE clause and INSERT INTO don't go together. either UPDATE with WHERE, or INSERT INTO on its own. ACE Link to comment https://forums.phpfreaks.com/topic/116000-mysql_query-error/#findComment-596463 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.