iceblox Posted April 28, 2008 Share Posted April 28, 2008 Hi Guys, I have a simple form that i seem to be having issues with and I cant see why it isnt working. This is the error i get Array ( [message] => 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 'desc, url, clickurl) VALUES ' at line 1 [code] => 1064 ) array(2) { ["message"]=> string(226) "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 'desc, url, clickurl) VALUES ' at line 1" ["code"]=> int(1064) } bool(true) and this is the insert code if(!empty($_POST["addbutton"])) { $result = $db->sql_query("INSERT INTO google (title, desc, url, clickurl) VALUES ('".forSql($_POST["title"])."', '".forSql($_POST["desc"])."', '".forSql($_POST["url"])."', '".forSql($_POST["clickurl"])."')"); if($result) $status = "<b>".$_POST["title"] . " added successfully</b>"; else { print_r($db->sql_error($result)); $status = "<b>Error could not add banner. " . var_dump($db->sql_error($result),true); } } Any ideas?[/code] Link to comment https://forums.phpfreaks.com/topic/103240-solved-insert-trouble/ Share on other sites More sharing options...
Gamic Posted April 28, 2008 Share Posted April 28, 2008 Desc is a keyword in mysql. Either change the name of that field or use ' marks around it. Link to comment https://forums.phpfreaks.com/topic/103240-solved-insert-trouble/#findComment-528785 Share on other sites More sharing options...
iceblox Posted April 28, 2008 Author Share Posted April 28, 2008 Ah, i dsisnt realise that.. Thanks very much Gamic, works now Cheers Link to comment https://forums.phpfreaks.com/topic/103240-solved-insert-trouble/#findComment-528796 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.