RE: [PHP] Test tables existance
| From: | Don Read | Date: | Sun, 30 Mar 2003 21:14:06 +0000 |
| Subject: | RE: [PHP] Test tables existance | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-141659@lists.php.net to get a copy of this message | ||
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 dread@texas.net
-- 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.