Check if MySQL table exists or not [duplicate]
Possible Duplicate: MySQL check if a table exists without throwing an exception I have a dynamic mysql query builder in my project that creates select queries from different tables. I need to check if the current processing table exists or not. Imagine that my tables are table1, table2, and table3. My code is something like this: <?php for($i = 1 ; $i <= 3 ; $i++) { $this_table = 'table'.$i; $query = mysql_query("SELECT * FROM $this_table"); // ... } ?> How can I do this check (Please tell me the simplest way). Updated mysqli version: if ($result = $mysqli->query("SHOW TABLES LIKE '".$table."'