RE: [PHP] Test tables existance

2003-03-30 Thread Don Read

On 30-Mar-2003 Antti wrote:
> How do I test if a mysql table exists or not? Is there a function for 
> this? I didn't find a good one.
> 
> -antti

function tableexists($tbl) {
$res = @mysql_query("SELECT 1 FROM $tbl LIMIT 1");
return ($res ? true : false);
}

Regards,
-- 
Don Read   [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

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



Re: [PHP] Test tables existance

2003-03-30 Thread Haseeb Iqbal
use mysql_query("show tables"); get them in array and then scan the array

thats what i would do if there isn;t any function


Friendship is always a sweet responsibility, never an opportunity.
HaSeEb IqBaL.
0300-4258030
- Original Message - 
From: "Antti" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 31, 2003 1:34 AM
Subject: [PHP] Test tables existance


> How do I test if a mysql table exists or not? Is there a function for 
> this? I didn't find a good one.
> 
> -antti
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



Re: [PHP] Test tables existance

2003-03-30 Thread Miles Thompson
Come on, check the mysql section of the PHP manual ... this took about 20 sec
http://www.php.net/manual/en/function.mysql-list-tables.php
At 11:34 PM 3/30/2003 +0300, Antti wrote:
How do I test if a mysql table exists or not? Is there a function for 
this? I didn't find a good one.

-antti

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


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