I want to use PHP to return a list of my tables containing a specific word.
I found mysql_tablename but apparently this function has been deprecated. How would I go about doing this?
$q = mysql_query("SHOW TABLES LIKE 'pattern'");
while ($row = @mysql_fetch_row($q))
{
echo $row[0]."<br>";
}
SHOW TABLES IN database LIKE 'pattern'You can Issue a query against information_schema.tables, should be something like
select * from information_schema.tables where table_name like '%keyword%';
Query the MySQL server for it:
SELECT table_name FROM INFORMATION_SCHEMA.TABLES
WHERE table_schema = 'db_name'
[AND table_name LIKE 'wild']
For tables containing a specific word, use the LIKE keyword to match it in the WHERE clause.
schemain it, can't remember exactly...