Monday, September 5, 2011

code for Check if a table exists in MYSQL.

use this command:
mysql> show tables like 'your_table_name';

in your php script you can check:
if(row_count==1)
/* then table exists; */

You can also try .

SHOW TABLES;

or

SHOW TABLES 'your_table_name';

For checking DataBases:

SHOW DATABASES;

or

SHOW DATABASES 'your_db_name';

No comments:

Post a Comment