Funtion to verify if table exists in data base


SUBMITTED BY: Guest

DATE: March 26, 2015, 2:36 p.m.

FORMAT: PHP

SIZE: 288 Bytes

HITS: 4933

  1. function table_ok($db, $table){
  2. $query = "SHOW TABLES FROM $db";
  3. $runQuery = mysql_query($query);
  4. $tables = array();
  5. while($row = mysql_fetch_row($runQuery)){
  6. $tables[] = $row[0];
  7. }
  8. if(in_array($table, $tables)){
  9. return TRUE;
  10. }
  11. }
  12. ?>

comments powered by Disqus