db_table_exists

5 database.pgsql.inc db_table_exists($table)
5 database.mysqli.inc db_table_exists($table)
5 database.mysql.inc db_table_exists($table)
6 database.mysqli.inc db_table_exists($table)
6 database.pgsql.inc db_table_exists($table)
6 database.mysql.inc db_table_exists($table)
7 database.inc db_table_exists($table)
8 database.inc db_table_exists($table)

Check if a table exists.

Parameters

$table: The name of the table.

Return value

TRUE if the table exists, and FALSE if the table does not exist.

Related topics

16 calls to db_table_exists()

File

includes/database.mysqli.inc, line 355
Database interface code for MySQL database servers using the mysqli client libraries. mysqli is included in PHP 5 by default and allows developers to use the advanced features of MySQL 4.1.x, 5.0.x and beyond.

Code

function db_table_exists($table) {
  return (bool) db_fetch_object(db_query("SHOW TABLES LIKE '{" . db_escape_table($table) . "}'"));
}
Login or register to post comments