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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
05-23-2003, 03:36 AM
|
#1
|
Member
Registered: Jun 2002
Location: Netherlands - Amsterdam
Distribution: RedHat 9
Posts: 549
Rep:
|
mysql tables with a -
Hi all,
A friend of mine made a database, but he named his tables like forum-thread. Mysql doesnt like those "-" signs in tables
mysql> select * from forum-thread;
ERROR 1064: You have an error in your SQL syntax near '-thread' at line 1
Does anyone know if i can adjust mysqld to accept the "-" in table names?
|
|
|
05-23-2003, 04:00 AM
|
#2
|
Senior Member
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243
Rep:
|
Use backticks around the table name
Code:
mysql> create table `test-table` (id int);
Query OK, 0 rows affected (0.01 sec)
mysql> drop table `test-table`;
Query OK, 0 rows affected (0.00 sec)
http://www.mysql.com/doc/en/Legal_names.html
HTH
Jamie...
|
|
|
05-23-2003, 04:02 AM
|
#3
|
Member
Registered: Jun 2002
Location: Netherlands - Amsterdam
Distribution: RedHat 9
Posts: 549
Original Poster
Rep:
|
Ok, thanks.
Do i also have to use backticks in my phpscripts if i want to retrieve something from the database?
|
|
|
05-23-2003, 04:14 AM
|
#4
|
Senior Member
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243
Rep:
|
I would guess so as I don't think that PHP will automatically delimit this. Give it a go and see if you get an error.
cheers
Jamie...
|
|
|
05-23-2003, 04:32 AM
|
#5
|
Member
Registered: Jun 2002
Location: Netherlands - Amsterdam
Distribution: RedHat 9
Posts: 549
Original Poster
Rep:
|
Thanks for all the help.
But it seems this wasnt the problem, it is a query which i (and mysql) really don't understand 
|
|
|
05-23-2003, 04:44 AM
|
#6
|
Senior Member
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243
Rep:
|
Why, what you trying to get working?
Jamie...
|
|
|
05-23-2003, 06:23 AM
|
#7
|
Member
Registered: Jun 2002
Location: Netherlands - Amsterdam
Distribution: RedHat 9
Posts: 549
Original Poster
Rep:
|
The guy who made the database and php scripts just has a query that won't work. I think the query is too large. I've advised him to use indexes. I hope it works.
|
|
|
05-23-2003, 06:27 AM
|
#8
|
Senior Member
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243
Rep:
|
I've never know a query be too large, although if he's not making proper use of indexes so the query is taking a long time (>30 secs by default) then PHP will time out. You can change this in your php.ini find mind you.
cheers
Jamie...
|
|
|
All times are GMT -5. The time now is 12:30 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|