Welcome to WebmasterWorld Guest from 54.159.44.227

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

"SHOW TABLES FROM $database" doesn't work with underscores?workaround?

     

carsten888

7:41 am on Apr 4, 2010 (gmt 0)

5+ Year Member



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 underscores in the database-name.

Is there a workaround so that this script could deal with underscores in database-names?

Readie

11:35 am on Apr 4, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Backticks, not quotes :)

$sql = 'SELECT TABLES FROM `' . $database_name . '`';

Readie

12:55 pm on Apr 4, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



SHOW TABLES FROM**

Typo sorry, I was a little hung over when I wrote that :)

bizminder

8:01 am on Apr 7, 2010 (gmt 0)

5+ Year Member



Just enter a row into the table assuming it exists, if the row is successfully added then it exists else it does not exist.

Matthew1980

8:06 am on Apr 7, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



This is the trouble with duplicates:-

[webmasterworld.com ]

Solved.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month