note 31905 deleted from function.mysql-list-fields by didou
| From: | didou@php.net | Date: | Sat, 17 May 2003 21:21:10 +0000 |
| Subject: | note 31905 deleted from function.mysql-list-fields by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-48273@lists.php.net to get a copy of this message | ||
Note Submitter: Markus Greiner
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(...);
}
...