Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch Topic

check if mysql table exists or not using -'php,mysql,table,exists'

check if mysql table exists or not  using -'php,mysql,table,exists'

  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:  

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

asked Sep 8, 2015 by rajesh
0 votes

Related Hot Questions

Government Jobs Opening