471,092 Members | 1,546 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,092 software developers and data experts.

SQL Update Statement in PHP failing

Hello,
I have been working on an extremely basic update query to a mysql
database, and cannot seem to stop getting errors. Here is my source
(minus the connection):

$query = 'UPDATE inventory SET imagename = \'' . $_POST['imagename'] .
'\', category = \'' . $_POST['category'] . '\', location = \'' .
$_POST['location'] . '\', comments = \'' . $_POST['comments'] .'\'
WHERE imageid = \'' . $_GET['id'] . '\'';

print($query);

$result = mysql_query($query, $link) or die("Query failed : " .
mysql_error());

if($result)
{
print('Update Successful!');
}

mysql_free_result($result);
mysql_close($link);
And the browser sees this:

UPDATE inventory SET imagename = 'slo', category = 'Ball Python',
location = 'slo', comments = 'foo' WHERE imageid = '3'Query failed :

Any Ideas? Thanks in advance for your response.

R. Binns
Jul 20 '05 #1
1 1136
copy and past the query into mysql and see what it says.
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Philip Boonzaaier | last post: by
2 posts views Thread by Max Sandman | last post: by
13 posts views Thread by Neil | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.