* Dan Anderson
> I am trying to make my PHP script autodetect when a table in a mySQL
> database exists, and when it doesn't, create it.
>
> Is there some way to do something like:
>
> SELECT * FROM tables WHERE name = "table_name";
>
> And get a result I could test for truth, and thus run my script?

SHOW TABLES LIKE "table\_name";

Note that the underscore must be escaped with a backslash, because the LIKE
operator use underscore as a wildcard for a single character. In other
words, this statement:

SHOW TABLES LIKE "table_name";

... would match "table_name", but also "tableAname" and tableBname".

--
Roger


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to