note 42329 rejected from function.mysql-list-tables by tix
| From: | tix@php.net | Date: | Wed, 12 May 2004 11:06:00 +0000 |
| Subject: | note 42329 rejected from function.mysql-list-tables by tix | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-69521@lists.php.net to get a copy of this message | ||
Note Submitter:
----
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.