Canman2005 Posted March 22, 2006 Share Posted March 22, 2006 Hi allWhy do I get a syntax error when using the sql statement[code]if ($_GET['action'] == "add"){ $sql ="UPDATE users SET type = 4 WHERE id = $id";@mysql_query($sql, $connection) or die(mysql_error());}[/code]I have a action also to delete a row which seems to work fine.Thanks in advanceEd Quote Link to comment https://forums.phpfreaks.com/topic/5534-syntax-error/ Share on other sites More sharing options...
Barand Posted March 22, 2006 Share Posted March 22, 2006 Are you sure you have a value for $id, or is your query$sql ="UPDATE users SET type = 4 WHERE id = ";As well as outputting mysql_error(), echo the $sql also. Quote Link to comment https://forums.phpfreaks.com/topic/5534-syntax-error/#findComment-19762 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.