Stooney Posted December 7, 2007 Share Posted December 7, 2007 just making sure I'm not crazy. This query won't seem to update. mysql_error(); isn't returning anything wrong. All the variables are filled correctly. mysql version 5 $update=mysql_query("UPDATE `stauctioneer_items` SET `name` = '$name', `desc` = '$desc', `barcode` = '$barcode', `quantity` = '$quantity', `received` = '$received' WHERE `itemid` = '$itemid' LIMIT 1"); } the query runs fine from phpmyadmin, just not from the script. also if it helps, the full chunk of code: else if($_GET['sp']=="ui"){ $name=mysql_real_escape_string($_POST['name']); $desc=mysql_real_escape_string($_POST['desc']); $barcode=mysql_real_escape_string($_POST['barcode']); $quantity=mysql_real_escape_string($_POST['quantity']); $received=mysql_real_escape_string($_POST['received']); $update=mysql_query("UPDATE `stauctioneer_items` SET `name` = '$name', `desc` = '$desc', `barcode` = '$barcode', `quantity` = '$quantity', `received` = '$received' WHERE `itemid` = '$itemid' LIMIT 1"); } Quote Link to comment Share on other sites More sharing options...
revraz Posted December 7, 2007 Share Posted December 7, 2007 I've never had to use a LIMIT before on an update, and you should only have 1 itemid, so try removing that. Quote Link to comment Share on other sites More sharing options...
aschk Posted December 7, 2007 Share Posted December 7, 2007 Might sounds like a silly question, but if you're not getting a MySQL error, is it even executing the SQL statement? Put everything into a $sql string. Then echo it out (to see what you're getting). Then run that through MySQL manually, and I suspect you will find that the SQL Query runs just fine, but it doesn't alter any lines (becuase the item id doesn't exist?). 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.