On 17-Feb-2003 [EMAIL PROTECTED] wrote:
> 
> What query would I use to check for an existence of a table within a
> database? I'm currently writting a set of scripts in php. Is this possible
> with MySQL or do I need to create a condition within PHP?
> 
> Thanks,
> 

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.
                            (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