Reputation: 142
The error I receive: 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 'release=2012-09-02
, platforms=Android
, link=`play.php?game=G' at line 6
The code:
$sql = "UPDATE
GameInformation
SET
keyIndex=`GameTest`,
name=`Game Test`,
release=`2012-09-02`,
platforms=`Android`,
link=`play.php?game=GameTest`,
icon=`img/thumb_gametest.png`,
thumb=`img/thumb_mini_gametest.png`,
swf=`swf/GameTest.swf`,
height=`500`,
width=`920`
WHERE
keyIndex=`GameTest2`";
$query = mysql_query($sql);
if (!$query) exit (mysql_error());
I've been trying different delimiters (braces, apostrophes, quotes) around my set vars with no avail. Is there a reserved word in here?
Update [Solved], corrected code:
$sql = 'UPDATE
`GameInformation`
SET
`keyIndex`="GameTest",
`name`="Game Test",
`release`="2012-09-02",
`platforms`="Android",
`link`="play.php?game=GameTest",
`icon`="img/thumb_gametest.png",
`thumb`="img/thumb_mini_gametest.png",
`swf`="swf/GameTest.swf",
`height`="500",
`width`="920"
WHERE
`keyIndex`="GameTest2"';
$query = mysql_query($sql);
if (!$query) exit (mysql_error());
Upvotes: 0
Views: 156
Reputation: 8355
release
is a reserved word in mysql.
http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html
Upvotes: 0
Reputation: 11080
You should use ` for table and column names and " or ' for content. RELEASE is a reserved word.
UPDATE
`GameInformation`
SET
`keyIndex`="GameTest",
`name`="Game Test",
`release`="2012-09-02",
`platforms`="Android",
`link`="play.php?game=GameTest",
`icon`="img/thumb_gametest.png",
`thumb`="img/thumb_mini_gametest.png",
`swf`="swf/GameTest.swf",
`height`="500",
`width`="920"
WHERE
`keyIndex`="GameTest2"
Upvotes: 5