I want to check table exists from my defined array. It return result but when i delete any table from database it still say ok. I want exactly have to be match from my array value and database tables name. so how can i improve???? plz help.
include 'connect.php';
function db_table_exists($table_array){
foreach ($table_array as $db_table) {
$check = mysql_query("SELECT * FROM `{$db_table}`");
if($check !== false){
return true;
}else{
return false;
}
}
}
define('USERS', 'users');
define('COMMENTS', 'test');
$tables = array(USERS, COMMENTS);
if(db_table_exists($tables) == true){
echo 'ok';
}else{
echo 'prob';
}