coder9 Posted July 19, 2008 Share Posted July 19, 2008 hello the codes $tmp_name = 'user_box' . $link; $query = "UPDATE jtablegrid SET '$tmp_name'='$username' WHERE game_no = 1; mysql_query($query) or die(mysql_error()); thank you. Link to comment https://forums.phpfreaks.com/topic/115574-is-this-update-syntax-correct/ Share on other sites More sharing options...
kenrbnsn Posted July 19, 2008 Share Posted July 19, 2008 No, the syntax is not correct. Field names should not be quoted with single quotes. Did you try it? <?php $tmp_name = 'user_box' . $link; $query = "UPDATE jtablegrid SET $tmp_name = '$username' WHERE game_no = 1; mysql_query($query) or die("Problem with the query: $query on line " . __LINE__ . '<br>' . mysql_error()); ?> Ken Link to comment https://forums.phpfreaks.com/topic/115574-is-this-update-syntax-correct/#findComment-594152 Share on other sites More sharing options...
coder9 Posted July 19, 2008 Author Share Posted July 19, 2008 No, the syntax is not correct. Field names should not be quoted with single quotes. Did you try it? <?php $tmp_name = 'user_box' . $link; $query = "UPDATE jtablegrid SET $tmp_name = '$username' WHERE game_no = 1; mysql_query($query) or die("Problem with the query: $query on line " . __LINE__ . '<br>' . mysql_error()); ?> Ken thank you KEN Link to comment https://forums.phpfreaks.com/topic/115574-is-this-update-syntax-correct/#findComment-594164 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.