pavalache Posted August 8, 2009 Share Posted August 8, 2009 Hello again, here's my problem with addtoshop.php mccodes2. Most of the time when i try to add the same item twice for the same price i get this error: QUERY 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 id=159' at line 1 Query was update usershopitems set quantity=quantity+ where id=159 Changing the prices eliminates the problem. thanks! Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted August 8, 2009 Share Posted August 8, 2009 Re: addtoshop error, please help. Quantity is not set. Quote Link to comment Share on other sites More sharing options...
pavalache Posted August 8, 2009 Author Share Posted August 8, 2009 Re: addtoshop error, please help. anything i should change here? $db->query("INSERT INTO usershopitems VALUES ('','{$us['id']}','{$r['inv_itemid']}','{$_GET['price']}','$quantity')"); } else { $theitem=mysql_fetch_array($checkforitem); $db->query("update usershopitems set quantity=quantity+{$_GET['quantity']} where id={$theitem['id']}"); } Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted August 8, 2009 Share Posted August 8, 2009 Re: addtoshop error, please help. try changing: $db->query("update usershopitems set quantity=quantity+{$_GET['quantity']} where id={$theitem['id']}"); to $qty = abs(intval($_REQUEST['quantity'])); $db->query("update usershopitems set quantity=quantity+{$qty} where id={$theitem['id']}"); Quote Link to comment Share on other sites More sharing options...
pavalache Posted August 8, 2009 Author Share Posted August 8, 2009 Re: addtoshop error, please help. Thanks, problem fixed. +1 :mrgreen: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.