Web Hosting Talk







View Full Version : You have an error in your SQL syntax; check the manual that corresponds to your MySQL


wayiran
08-18-2006, 09:32 AM
I'm getting this error, can you help me????

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 '!)' at line 4

maxymizer
08-18-2006, 10:17 AM
I'm getting this error, can you help me????

Sure, post your query. You have an error in your SQL syntax. What kind of error it is - hard to say without seeing it.

maiahost
08-18-2006, 10:21 AM
could you please post the query so we can see where the error is ?

wayiran
08-18-2006, 11:18 AM
I found it...

$con = mysql_connect("localhost","Admin","123456789");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("yui", $con);
$sql="INSERT INTO web
(address,title)
VALUES
($address,$title)";
if (!mysql_query($sql,$con))
{
die('Error1: ' . mysql_error());
}

I had to change it to:

$con = mysql_connect("localhost","Admin","123456789");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("yui", $con);
$sql="INSERT INTO web
(address,title)
VALUES
('$address','$title')";
if (!mysql_query($sql,$con))
{
die('Error1: ' . mysql_error());
}

instead of ($address,$title) I had to use ('$address','$title')