Re: Table exists?
| From: | CC Zona | Date: | Sat, 09 Feb 2002 20:30:20 +0000 |
| Subject: | Re: Table exists? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-84131@lists.php.net to get a copy of this message | ||
In article <20020209182841.GB3122@explodingnet.com>,
nick@explodingnet.com (Nick Wilson) wrote:
> What would be the easiest way to see if a MySQL table exists with PHP?
> I can do it by checking against mysql_list_tables() but that seems a
> little clumsy. Is there a better way?
See MySQL's documentation of the "CREATE TABLE" and "DROP TABLE" syntax:
both support table existance checks.
create table if not exists mytablename...
drop table if exists mytablename...
--
CC