List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:February 17 2003 4:21pm
Subject:Re: Checking existence of a table.
View as plain text  
At 11:10 -0500 2/17/03, <ed@stripped> 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?

You can check the output of SHOW TABLES or you can issue the following
query and see if it produces an error (if so, the table doesn't exist):

SELECT * FROM tbl_name WHERE 0

The WHERE 0 part prevents the query from returning rows if the table
does exist.

>
>Thanks,
>
>Ed
>
>mysql

Thread
Checking existence of a table.ed17 Feb
  • Re: Checking existence of a table.Paul DuBois17 Feb
    • Re: Checking existence of a table. (finished)ed17 Feb
  • Re: Checking existence of a table.Jerry17 Feb
  • RE: Checking existence of a table.Don Read17 Feb
  • Re: Checking existence of a table.Stefan Hinz17 Feb
RE: Checking existence of a table.Simon Green17 Feb