LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-26-2003, 01:08 PM   #1
nullpt
Member
 
Registered: Jul 2003
Distribution: Red Hat
Posts: 94

Rep: Reputation: 15
mysql error


Hi there folks,

I'm getting some error with this line and i can't find what is rong:

mysql_query("INSERT INTO order (name, addr, country, clan, chan, email) VALUES ('$name', '$addr', '$country', '$clan', '$chan', '$email')") or die("Couldn't connect!" . mysql_error());

The vars exist and have values.

It's giving me this error:

You have an error in your SQL syntax near 'order (name, addr, country, clan, chan, email) VALUES ('alex', 'lol', 'lo', 'lo'' at line 1

Thanks in advance
 
Old 07-26-2003, 01:15 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
order is a reserved word. change it to "orders" or something similar
 
Old 07-26-2003, 03:36 PM   #3
nullpt
Member
 
Registered: Jul 2003
Distribution: Red Hat
Posts: 94

Original Poster
Rep: Reputation: 15
Thanks a lot mate.

btw, how can i change the table name?

I have a lot of work there and i dont want to waste it :\
 
Old 07-26-2003, 05:34 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
a simple look at the mysql manual says:

ALTER name RENAME [TO] newname
 
Old 07-27-2003, 03:18 AM   #5
nullpt
Member
 
Registered: Jul 2003
Distribution: Red Hat
Posts: 94

Original Poster
Rep: Reputation: 15
Thanks a lot mate, but i can't do that due to the reserved word... if I place ORDER in the SQL the database assumes ORDER as the reserved name of SQL and not as a table name

Thamks anyway mate []
 
Old 07-27-2003, 04:05 AM   #6
danny_kurniawan
Member
 
Registered: Jul 2003
Location: Surabaya - East Java, Indonesia
Distribution: Red Hat, Mandrake, Debian, Knoppix
Posts: 57

Rep: Reputation: 15
Try using backquotes (`) for table name...
 
Old 07-27-2003, 04:08 PM   #7
nullpt
Member
 
Registered: Jul 2003
Distribution: Red Hat
Posts: 94

Original Poster
Rep: Reputation: 15
Thanks a lot!

[][]
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. NoviceW Linux - Networking 17 09-17-2014 03:13 PM
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. suziecorbett Linux - Software 8 10-09-2008 02:52 AM
Starting MySQL OLD Error : imeout error occurred trying to start MySQL Daemon Fr33B5D Linux - Software 9 10-28-2006 07:23 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 09:44 AM
Error compiling perl-DBD-MySQL after upgrading to MySQL 4.1 pitaro920 Linux - Software 1 01-16-2006 05:28 PM


All times are GMT -5. The time now is 08:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration