s4salman Posted October 11, 2012 Share Posted October 11, 2012 Hello i am getting this error message, please help me to correct it : Invalid query: 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 'table (id, name, description, linkdown, pubsite, category, image, os) VALUES ('' at line 1 The code is as follows : <?php /// In order /// you /// information in this file: /// Copyright 2012 /// All rights reserved. include("connect.php"); $name = trim(mysql_real_escape_string($_POST["name"])); $description = trim(mysql_real_escape_string($_POST["description"])); $linkdown = trim(mysql_real_escape_string($_POST["linkdown"])); $pubsite = trim(mysql_real_escape_string($_POST["pubsite"])); $category = trim(mysql_real_escape_string($_POST["category"])); $image = trim(mysql_real_escape_string($_POST["image"])); $os = trim(mysql_real_escape_string($_POST["os"])); $results = mysql_query("INSERT INTO table (id, name, description, linkdown, pubsite, category, image, os) VALUES ('', '$name', '$description', '$linkdown', '$pubsite', '$category', '$image', '$os')"); if($results) { echo "Successfully Added"; } else { die('Invalid query: '.mysql_error()); } ?> <a href="index.php">Back to index</a> Quote Link to comment https://forums.phpfreaks.com/topic/269340-sysntax-error/ Share on other sites More sharing options...
requinix Posted October 11, 2012 Share Posted October 11, 2012 "table" is a reserved word. Rename your table to something that's actually, you know, useful? Quote Link to comment https://forums.phpfreaks.com/topic/269340-sysntax-error/#findComment-1384457 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.