note 42329 added to function.mysql-list-tables

From: Date: Wed, 12 May 2004 10:37:53 +0000
Subject: note 42329 added to function.mysql-list-tables
Groups: php.notes 
Request: Send a blank email to php-notes+get-69518@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/function.mysql-list-tables.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+42329 Delete -- http://master.php.net/manage/user-notes.php?action=delete+42329&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+42329&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#69518) next »