查看mysql数据库是否存在某张表

通过information_schema查询数据库是否存在某张表

select t.table_name from information_schema.TABLES t where t.TABLE_SCHEMA ='".$database."' and t.TABLE_NAME ='".$table."';
$database:查询的数据库
$table :查询表格

返回:若存在则返回表明,不存在返回为空

猜你喜欢

转载自www.cnblogs.com/yaradish/p/10078640.html