Jump to content

[SOLVED] Error is SQL syntax from PHP script, why me?


elite_prodigy

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.