LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 05-23-2003, 03:36 AM   #1
pk21
Member
 
Registered: Jun 2002
Location: Netherlands - Amsterdam
Distribution: RedHat 9
Posts: 549

Rep: Reputation: 30
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?
 
Old 05-23-2003, 04:00 AM   #2
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 46
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...
 
Old 05-23-2003, 04:02 AM   #3
pk21
Member
 
Registered: Jun 2002
Location: Netherlands - Amsterdam
Distribution: RedHat 9
Posts: 549

Original Poster
Rep: Reputation: 30
Ok, thanks.

Do i also have to use backticks in my phpscripts if i want to retrieve something from the database?
 
Old 05-23-2003, 04:14 AM   #4
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 46
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...
 
Old 05-23-2003, 04:32 AM   #5
pk21
Member
 
Registered: Jun 2002
Location: Netherlands - Amsterdam
Distribution: RedHat 9
Posts: 549

Original Poster
Rep: Reputation: 30
Thanks for all the help.

But it seems this wasnt the problem, it is a query which i (and mysql) really don't understand
 
Old 05-23-2003, 04:44 AM   #6
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 46
Why, what you trying to get working?

Jamie...
 
Old 05-23-2003, 06:23 AM   #7
pk21
Member
 
Registered: Jun 2002
Location: Netherlands - Amsterdam
Distribution: RedHat 9
Posts: 549

Original Poster
Rep: Reputation: 30
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.
 
Old 05-23-2003, 06:27 AM   #8
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 46
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...
 
  


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
mysql reinstallation distorted by previous tables in /var/mysql mad4linux Linux - Software 0 10-04-2005 01:39 PM
MySQL tables from 4.0 to 3.0 michaelbhahn Linux - Software 0 08-31-2004 10:23 AM
mysql count tables in a database Longinus Programming 2 04-11-2004 01:22 AM
Corrupted MySQL Tables cli_man Linux - Software 4 10-22-2003 06:49 AM
mysql tables noord28 Linux - Newbie 0 02-20-2003 02:56 AM


All times are GMT -5. The time now is 07:04 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration