Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
|
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 7th, 2004, 09:32 AM
Authorized User
 
Join Date: Dec 2003
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default INSERT syntax error

Can anyone tell me whats wrong with my syntax? I have a php script that I am trying to use to upload data from a csv file into my table. I get this error when I run it:

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 'dec, catalog_num, constellation ) VALUES ( '23.23964', '-14.991

My SQL statement is:

mysql_query( "INSERT INTO test ( ra, dec, catalog_num, constellation ) VALUES ( '$ra', '$dec', '$catalog_num', '$constellation' )" ) or die( mysql_error());

thanks!

 
Old October 7th, 2004, 05:30 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Echo the processed query and post it here please.

$query = "INSERT INTO test ( ra, dec, catalog_num, constellation ) VALUES ( '$ra', '$dec', '$catalog_num', '$constellation' )";

echo $query;

Please tell me what it says.

-Snib <><
http://www.snibworks.com
There are only two stupid questions: the one you don't ask, and the one you ask more than once ;)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax error when using "Insert Into" Luis Access VBA 14 November 18th, 2008 03:09 PM
Syntax Error on Insert dalezjc Classic ASP Basics 29 June 20th, 2007 06:50 PM
Syntax error INSERT INTO ITladybug ADO.NET 2 January 31st, 2006 07:50 AM
Syntax error in INSERT INTO statement. kingleon Classic ASP Basics 1 May 10th, 2005 06:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.