Skip to main content
October 16, 2009
Question

form data failing to submit

  • October 16, 2009
  • 1 reply
  • 684 views

I have created a simple form with corresponding database table but I get this error message whenever I submit:

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 'condition, trailer) VALUES ('Steve Tester', 'steve@test.net', '333-333-3333', 's' at line 1

i have checked and rechecked to make sure all the values are identical. Help!

the form is at http://floridaautotransport.org/quote.php

thanks!

This topic has been closed for replies.

1 reply

David_Powers
Inspiring
October 17, 2009

Until you understand what they mean, MySQL error messages can be mystifying. Unfortunately, simply showing the error message to another person doesn't help much either. However...

What MySQL means when it says "check for the right syntax to use near 'XYZ...'" is that the error is immediately before 'XYZ...'.

To troubleshoot MySQL errors, you need to use echo to display the actual SQL query being submitted to the database. This involves going into Code view and making a quick edit. The following is part of the code for a recordset called getAuthors:

$query_getAuthors = sprintf("SELECT first_name, family_name FROM authors WHERE first_name = %s ORDER BY family_name ASC", GetSQLValueString($colname_getAuthors, "text"));
$getAuthors = mysql_query($query_getAuthors, $connQuery) or die(mysql_error());

To display the actual SQL query, edit it like this:

$query_getAuthors = sprintf("SELECT first_name, family_name FROM authors WHERE first_name = %s ORDER BY family_name ASC", GetSQLValueString($colname_getAuthors, "text"));

echo $query_getAuthors;

exit;

$getAuthors = mysql_query($query_getAuthors, $connQuery) or die(mysql_error());

This displays the SQL query without submitting it to the database. Even if you don't understand the error yourself, copy the SQL query and post it here. Someone should be able to identify the problem.

Obviously, you should use the variable that relates to your recordset instead of $query_getAuthors. It's $query_ followed by the name of the recordset.

October 17, 2009

This is the data failing to submit: SELECT * FROM employeelookup 0