Toggle navigation
Dashboard
Dashboard Tracker
Add / Edit My Forums
System Announcements
Discussion
Active Thread Feed
Top Threads Today
Top Threads This Week
Top Threads Library
Go!
View All
View All
Login
Logout
Home
Forums Index
Server Side
/
PHP Server Side Scripting
3:26 pm Apr 28, 2026
This page requires javascript.
Forum Moderators:
coopster
Message Too Old, No Replies
"SHOW TABLES FROM $database" doesn't work with '-'? workaround?
carsten888
Msg#:4109678
9:00 am on Apr 4, 2010
(gmt 0)
SHOW TABLES FROM '".$database_name."'
I need to test for the existence of a table in the database. This query works fine as long as there are no - in the database-name.
Is there a workaround so that this script could deal with - in database-names?
rocknbil
Msg#:4109839
8:21 pm on Apr 4, 2010
(gmt 0)
You don't need to quote it. You quote the data in fields, not field names or db/table names. That might be the problem all by iself.
I don't even know if any of these will work. :-) The first two are most likely.
$query = "SHOW TABLES FROM ".$database_name;
$query = "SHOW TABLES FROM `".$database_name."`";
Note those are backticks, not quotes.
$query = "SHOW TABLES FROM ".mysql_real_escape_string($database_name);
EDIT:
ahhh, dupe thread, I hate it when that happens, mods please splice:
Duplicate thread
[webmasterworld.com]
carsten888
Msg#:4110747
1:44 pm on Apr 6, 2010
(gmt 0)
Thank you very much. That was it!
Join The Conversation
Register
For Free! -
Become a
Pro Member
!
See forum categories
-
Enter the Forum
Moderators and Top Contributors
Moderator List
| Top Contributors:
This Week
,
This Month
,
Mar
,
Feb
,
Archive
,
Top 100 All Time
,
Top Voted Members
Hot Threads This Week
April 2026 Google Search Observations
Hello again, it's been a while
AdSense Earnings and Observations - April 2026
Do you get tired of others copying your content?
5 SEO Tips That Actually Worked for My Blog in 2026
I need some SEO help
iPhone Safari 26.4.1 errors: IPv4 & Host
2025 Link Building Trends and Insights
Does SEO matter any more?
SEO question
Home
Forums Index
Server Side
/
PHP Server Side Scripting
3:26 pm Apr 28, 2026