Jump to content

sql update query


Stooney

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.