Web Hosting Talk







View Full Version : Perl & mySQL


YUPAPA
12-19-2003, 03:30 AM
i dunno what's wrong but when i try to select data from the table 'usage', but it gives me


DBD::mysql::st execute failed: You have an error in your SQL syntax near 'usage' at line 1 at test.pl line 6.
Fail to execute: You have an error in your SQL syntax near 'usage' at line 1 :deer:


I replace 'usage' with another table name like 'quota', it works fine... i even dropped the table and recreate it, but still same error~ Is 'usage' a reserved name? i have this version of mysql installed on both servers~


mysql Ver 11.17 Distrib 3.23.49a :santa2:


can anyone try to create a table with 'usage' and select stuff from it? :angel:

I am using perl~ no php here~ so sorry :stickout:

ub3r
12-19-2003, 03:38 AM
mikey@monkey[~]% mysqladmin -u root -p create usage
Enter password:
mikey@monkey[~]% mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 3.23.58

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select * from usage;
ERROR 1064: You have an error in your SQL syntax near 'usage' at line 1



hmm... that's a toughy. I suggest you ask on irc.freenode.net #mysql .

ub3r
12-19-2003, 03:42 AM
got an answer for you:

http://www.mysql.com/doc/en/Reserved_words.html

yep, it's reserved.

YUPAPA
12-19-2003, 04:12 AM
THANK YOU THANK YOU! :stickout:
You are so fast and so nice~ :):):):):)

ub3r
12-19-2003, 04:13 AM
that's what i'm here for . :)