Our blog
Check if MySQL Table Exists
Sometime you need a PHP script to check for the existence of a MySQL table. This function achieves that for you.
-
function db_table_exists($table){
-
$exists = false;
-
$tables_query = db_query("SHOW TABLES FROM " . MYSQL_DB);
-
foreach($t as $k=>$v){
-
if($v == $table){
-
$exists = true;
-
break;
-
}
-
}
-
}
-
return $exists;
-
}
RSS Feed