note 31905 added to function.mysql-list-fields
| From: | Markus at rack1 dot php dot net | Date: | Thu, 08 May 2003 13:07:23 +0000 |
| Subject: | note 31905 added to function.mysql-list-fields | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-47694@lists.php.net to get a copy of this message | ||
to check the existence of a table you can use mysql_list_fields:
function mysql_table_exists($dbname,$tablename,$res)
{
$fields = @mysql_list_fields($dbname,$tablename,$res);
return @mysql_num_fields($fields);
}
$res = mysql_connect(...);
if (!mysql_table_exists("accounting","2003_05",$res))
{
create_new_table(...);
}
...
--
http://www.php.net/manual/en/function.mysql-list-fields.php
http://master.php.net/manage/user-notes.php?action=edit+31905
http://master.php.net/manage/user-notes.php?action=delete+31905
http://master.php.net/manage/user-notes.php?action=reject+31905