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
11:32 pm Aug 9, 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
,
Jul
,
Jun
,
Archive
,
Top 100 All Time
,
Top Voted Members
Hot Threads This Week
August 2026 Google Search Observations
AdSense Earnings and Observations - August 2026
Booking Feels Google AI Effects - Plans SEO decline
July 2026 Google Search Observations
EU AI Transparency Rules Now in Effect
How has AI changed your work?
Do you still build external links in 2026?
Home
Forums Index
Server Side
/
PHP Server Side Scripting
11:32 pm Aug 9, 2026