note 42330 deleted from function.mysql-list-tables by sp
| From: | sp@php.net | Date: | Sun, 29 Jan 2006 20:29:51 +0000 |
| Subject: | note 42330 deleted from function.mysql-list-tables by sp | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-102685@lists.php.net to get a copy of this message | ||
Note Submitter: zeubeubeu at free dot fr
----
Just another way to verify the existence of a table based on the function below :
function mysql_table_exists($base, $table, $link)
{
$exists = mysql_query('SHOW TABLES FROM
'.$base.' LIKE
\''.$table.'\'', $link);
return mysql_num_rows($exists) == 1;
}
You can extend this function for multi-checks by changing the pattern of the LIKE if you store
separate tables for archive like LIKE 'mails_200%' for example.