Re: [Phplib-users] Test whether db table exists using DB_SQL
Brought to you by:
nhruby,
richardarcher
From: Richard A. <rh...@ju...> - 2001-08-15 21:18:19
|
At 9:05 AM +0100 15/8/01, Peter Bowyer wrote: >Hi list, > >I need to test whether a table exists in the database, showing data from it >if it does, and showing a button telling the user to "Create the table" if >it doesn't. However, all SQL I've tried throws up the following error: Open a connection to the database server, select the database and run the query "show tables". You'll get back a result set like: mysql> show tables; +-----------------------+ | Tables_in_j0_phplib | +-----------------------+ | active_sessions | | active_sessions_split | | auth_user | | auth_user_md5 | | db_sequence | +-----------------------+ 5 rows in set (0.00 sec) Just loop through the results looking for your table. ...R. |