db_escape_table

includes/database.inc, line 321

Versions
4.7 – 6
db_escape_table($string)
7
db_escape_table($table)

Restrict a dynamic tablename to safe characters.

Only keeps alphanumeric and underscores.

Related topics

▾ 1 function calls db_escape_table()

db_lock_table in includes/database.pgsql.inc
Lock a table. This function automatically starts a transaction.

Code

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

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.