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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.