note 38341 added to function.mysql-tablename
| From: | platthinkmetricsdotcom at rn2 dot php dot net | Date: | Wed, 17 Dec 2003 13:00:13 +0000 |
| Subject: | note 38341 added to function.mysql-tablename | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-62113@lists.php.net to get a copy of this message | ||
A simple function to check for the existance of a table:
function TableExists($tablename, $db) {
// Get a list of tables contained within the database.
$result = mysql_list_tables($db);
$rcount = mysql_num_rows($result);
// Check each in list for a match.
for ($i=0;$i<$rcount;$i++) {
if (mysql_tablename($result, $i)==$tablename) return true;
}
return false;
}
----
Manual Page -- http://www.php.net/manual/en/function.mysql-tablename.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38341
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38341&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38341&report=yes
Search -- http://master.php.net/manage/user-notes.php