elite_prodigy Posted December 2, 2008 Share Posted December 2, 2008 I swear I get more errors when programming PHP than an idiot writing HTML.... This code is suposed to update the content of a page on the site but it delivers the following 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 'WHERE id=1 SET display='Home'' This is the code throwing the error: <?php include 'config.php'; mysql_select_db('exembar_site'); $title = $_POST['title']; $display = $_POST['display']; $top = $_POST['topbar']; $content = $_POST['content']; $id = $_GET['id']; $sql = "UPDATE `navigation` WHERE id='{$id}' SET `display`='{$display}'"; mysql_query($sql) or die(mysql_error()); $sql = "UPDATE `pages` WHERE `navId`='{$id}' SET `title`='{$title}'"; mysql_query($sql) or die(mysql_error()); $SQL = "UPDATE `content` WHERE `pageId`='{$id}' SET `topBar`='{$top} `content`='{$content}"; mysql_query($sql) or die(mysql_error()); ?> Where did I go wrong this time? As always you help is most appreciated! -David Quote Link to comment https://forums.phpfreaks.com/topic/135104-solved-error-is-sql-syntax-from-php-script-why-me/ Share on other sites More sharing options...
haku Posted December 2, 2008 Share Posted December 2, 2008 UPDATE table SET something=something_else WHERE another_thing=a_value Quote Link to comment https://forums.phpfreaks.com/topic/135104-solved-error-is-sql-syntax-from-php-script-why-me/#findComment-703722 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.