There is an example in the php manual.

http://uk.php.net/manual/en/function.mysql-list-tables.php

chrisshaffer at bellsouth dot net wrote :

function mysql_table_exist($tableName)
{
$query = "SELECT COUNT(*) FROM $tableName";
       $result = mysql_query($query);
$num_rows = @mysql_num_rows($result);
if($num_rows)
{
return TRUE;
}
else
{

return FALSE;
}

}


Jerry


----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 17, 2003 4:10 PM
Subject: Checking existence of a table.


>
> 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,
>
> Ed
>
>
> mysql
>
>
> ---------------------------------------------------------------------
> 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
>


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