At 11:10 -0500 2/17/03, <[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?
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

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