zackcez Posted May 15, 2008 Share Posted May 15, 2008 I have this: <?php $username = "admin"; $password = "msg1028"; $hostname = "localhost"; $dbh = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $selected = mysql_select_db("forum",$dbh) or die("Could not select first_test"); $jid = $_GET['jid']; $resultr = mysql_query("UPDATE join SET show = '2' WHERE id='$jid'"); ?> and I get this error: 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 'join SET show = '2' WHERE id='1'' at line 1 Link to comment https://forums.phpfreaks.com/topic/105681-mysql-update/ Share on other sites More sharing options...
btherl Posted May 15, 2008 Share Posted May 15, 2008 Try changing it to $resultr = mysql_query("UPDATE `join` SET `show` = '2' WHERE id='$jid'"); But it's probably better to rename that table if you can. Both "join" and "show" are special words in mysql. Link to comment https://forums.phpfreaks.com/topic/105681-mysql-update/#findComment-541449 Share on other sites More sharing options...
StormTheGates Posted May 15, 2008 Share Posted May 15, 2008 Always gotta watch out about blending mysql command words with data names. Link to comment https://forums.phpfreaks.com/topic/105681-mysql-update/#findComment-541457 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.