Jump to content

[SOLVED] Ugh - simple MySQL update query giving me trouble


avillanu

Recommended Posts

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

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.

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

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.