Re: [PHP] Re: Table exists?

2002-02-09 Thread Nick Wilson

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


* and then CC Zona declared
> In article <[EMAIL PROTECTED]>,
>  [EMAIL PROTECTED] (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...

Yeah, but I don't want to create or drop the table, I just want to check
it exists. Thanks anyway.

- -- 

Nick Wilson

Tel:+45 3325 0688
Fax:+45 3325 0677
Web:www.explodingnet.com



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE8ZYtKHpvrrTa6L5oRAstZAKCbKPBSjja+WkBB6xuV3p/CL5+u3ACgrHVS
HzIhSNIpfVAVtEtOnLpvYMU=
=D7Ja
-END PGP SIGNATURE-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Table exists?

2002-02-09 Thread CC Zona

In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: Table exists?

2002-02-09 Thread Nick Wilson

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


* and then Martin C. Petersen declared
> Do a select on the table - if the query returns true the table exists 
> otherwise the test is inconclusive..

Yep, that'l do it. cheers.

- -- 

Nick Wilson

Tel:+45 3325 0688
Fax:+45 3325 0677
Web:www.explodingnet.com



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE8ZYQEHpvrrTa6L5oRAnT2AKCxXgZv9C5+4RCu/Atn5sLCOF7pmACfbgAc
Trt749MnUo6/GJsU+D6ykyg=
=QXfl
-END PGP SIGNATURE-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Table exists?

2002-02-09 Thread Martin C. Petersen

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?
Do a select on the table - if the query returns true the table exists 
otherwise the test is inconclusive..

Best regards 
Martin Petersen

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php