You are here

function db_escape_table in Drupal 5

Same name and namespace in other branches
  1. 8 core/includes/database.inc \db_escape_table()
  2. 4 includes/database.inc \db_escape_table()
  3. 6 includes/database.inc \db_escape_table()
  4. 7 includes/database/database.inc \db_escape_table()

Restrict a dynamic tablename to safe characters.

Only keeps alphanumeric and underscores.

Related topics

7 calls to db_escape_table()
db_lock_table in includes/database.mysqli.inc
Lock a table.
db_lock_table in includes/database.mysql.inc
Lock a table.
db_lock_table in includes/database.pgsql.inc
Lock a table. This function automatically starts a transaction.
db_table_exists in includes/database.mysqli.inc
Check if a table exists.
db_table_exists in includes/database.mysql.inc
Check if a table exists.

... See full list

File

includes/database.inc, line 310
Wrapper for database interface code.

Code

function db_escape_table($string) {
  return preg_replace('/[^A-Za-z0-9_]+/', '', $string);
}