db_escape_table

Definition

db_escape_table($string)
includes/database.inc, line 321

Description

Restrict a dynamic tablename to safe characters.

Only keeps alphanumeric and underscores.

Related topics

Namesort iconDescription
Database abstraction layerAllow the use of different database servers using the same code base.

Code

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

Drupal is a registered trademark of Dries Buytaert.