Hi,
I using PHP 4.4.2 and MySQL 4.1.20-community-nt with IIS 6 on windows 2003 server. When I try to insert a row through the PHP code into a mysql table I'm getting the following error in the webpage
"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 ''Quote')' at line 1"
If I use the select statement it's working properly but when I use insert it gives that error. Could anyone plase help me on this issue.
Thanks,
oliver.
PHP - MYSQL Error
Moderator: General Moderators
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
When you develop locally you can use the SQL string in your die statement to see the actual query being passed to the database.
Code: Select all
<?php
$sql = 'INSERT INTO `table` (`field`, `otherfield`) VALUES (\'$value\', \'$othervalue\')';
if (!$result = mysql_query($sql))
{
die('Could not perform insert using <strong>' . $sql . '</strong>: ' . mysql_error());
}
?>