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"); } Link to comment https://forums.phpfreaks.com/topic/80589-sql-update-query/ 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. Link to comment https://forums.phpfreaks.com/topic/80589-sql-update-query/#findComment-408669 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?). Link to comment https://forums.phpfreaks.com/topic/80589-sql-update-query/#findComment-408674 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.