On 27-Mar-2002 Ken Anderson wrote:
> 
> 
> 
> 
>  
>  What is the fastest way to check if a table exists?
>  Do a select and catch the error?
>  Try to create the table, and catch the error?
>  Other options?
>  Thanks,
>  Ken

Yes, in php:

function tableexists($tbl) {
    $res = @mysql_query( "SELECT count(*) FROM $tbl");
    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.
                            (53kr33t w0rdz: sql table query)

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to