avillanu Posted August 30, 2007 Share Posted August 30, 2007 I have spent a good amount of time testing this. Does not work: $query31 = "update generic_games set name = '$name' where id='$id'"; $result31 = mysql_query($query31); $query31 = "update generic_games set name = '$name', desc = '$desc', image = '$image', filename = '$filename', cat = '$cat' where id='$id'"; $result31 = mysql_query($query31); Neither gives any error. The problem seems to be when I add multiple columns to update. I have done tons of googling and they all seem to say to separate columns with a simple comma... Quote Link to comment https://forums.phpfreaks.com/topic/67328-solved-ugh-simple-mysql-update-query-giving-me-trouble/ Share on other sites More sharing options...
wildteen88 Posted August 30, 2007 Share Posted August 30, 2007 Use mysql_error() in an or die clause after mysql_query: $result31 = mysql_query($query31) or die('Problem with Query:<br />' . $query31 . '<br />' . mysql_error()); Rerun your code. This time if there is a problem with your query an error message will be displayed. Quote Link to comment https://forums.phpfreaks.com/topic/67328-solved-ugh-simple-mysql-update-query-giving-me-trouble/#findComment-337786 Share on other sites More sharing options...
avillanu Posted September 3, 2007 Author Share Posted September 3, 2007 OK I inserted the code as instructed. This is what I got: Problem with Query: update generic_games set name = '12 Holes of X-Mazzzx', desc = 'Pick your putter and go out to putt a hole in one.Move the ball to where you want it then click,move your mouse according to the arrow then click to shoot the ball, and play all twelve holes', image = '12 Holes of X-Mas.png', filename = '12 Holes of X-Mas.swf', cat = '1' where id='1' You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc = 'Pick your putter and go out to putt a hole in one.Move the ball to where' at line 2 Quote Link to comment https://forums.phpfreaks.com/topic/67328-solved-ugh-simple-mysql-update-query-giving-me-trouble/#findComment-340124 Share on other sites More sharing options...
Barand Posted September 3, 2007 Share Posted September 3, 2007 DESC is MySQL reserved word. Change column name or use `desc` Quote Link to comment https://forums.phpfreaks.com/topic/67328-solved-ugh-simple-mysql-update-query-giving-me-trouble/#findComment-340146 Share on other sites More sharing options...
avillanu Posted September 4, 2007 Author Share Posted September 4, 2007 Thanks - it does work when I remove the desc part... 'desc' however does not work...I'd really prefer not having to rename the column, any ideas how this can be done? Quote Link to comment https://forums.phpfreaks.com/topic/67328-solved-ugh-simple-mysql-update-query-giving-me-trouble/#findComment-341382 Share on other sites More sharing options...
Barand Posted September 4, 2007 Share Posted September 4, 2007 single quotes won't work. See my post. Quote Link to comment https://forums.phpfreaks.com/topic/67328-solved-ugh-simple-mysql-update-query-giving-me-trouble/#findComment-341410 Share on other sites More sharing options...
avillanu Posted September 11, 2007 Author Share Posted September 11, 2007 Working, thanks Quote Link to comment https://forums.phpfreaks.com/topic/67328-solved-ugh-simple-mysql-update-query-giving-me-trouble/#findComment-346195 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.