本文整理汇总了PHP中sql_db::sql_escape方法的典型用法代码示例。如果您正苦于以下问题:PHP sql_db::sql_escape方法的具体用法?PHP sql_db::sql_escape怎么用?PHP sql_db::sql_escape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sql_db
的用法示例。
在下文中一共展示了sql_db::sql_escape方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
// HTML HEADER - BEGIN
echo("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n");
echo("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n");
echo("<head>\n");
echo("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n");
echo("<meta name=\"author\" content=\"Icy Phoenix Team\" />\n");
echo("<title>Icy Phoenix :: UTF-8 Conversion</title>\n");
echo("</head>\n");
echo("<body>\n");
echo("<div style=\"font-family: 'Lucida Grande', 'Trebuchet MS', Verdana, Helvetica, Arial, sans-serif; font-size: 10px;\">\n");
echo("<b style=\"color: #dd2222;\">DB Conversion to UTF-8 in progress, please do not stop the browser until the whole process is finished...</b><br />\n<br />\n<br />\n");
// HTML HEADER - END
flush();
$sql = "ALTER DATABASE {$db->sql_escape($dbname)}
CHARACTER SET utf8
DEFAULT CHARACTER SET utf8
COLLATE utf8_bin
DEFAULT COLLATE utf8_bin";
$db->sql_query($sql) or die($db->sql_error());
$sql = "SHOW TABLES";
$result = $db->sql_query($sql) or die($db->sql_error());
while ($row = $db->sql_fetchrow($result))
{
// This assignment doesn't work...
//$table = $row[0];
$current_item = each($row);
$table = $current_item['value'];
示例2: varchar
if ($mode == 'restore') {
// Drop existing Config Table
$sql = 'DROP TABLE IF EXISTS ' . PREFIX . 'config';
$result = $db->sql_query($sql);
// Create Config table
$sql = 'CREATE TABLE ' . PREFIX . 'config (
`config_name` varchar(255) NOT NULL ,
`config_value` text NOT NULL ,
PRIMARY KEY (`config_name`)
)';
$result = $db->sql_query($sql);
// Insert config data
$sql = 'SELECT * FROM ' . PREFIX . 'ctracker_backup';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$sql2 = 'INSERT INTO ' . PREFIX . 'config (`config_name`, `config_value`) VALUES (\'' . $db->sql_escape($row['config_name']) . '\', \'' . $db->sql_escape($row['config_value']) . '\')';
$result2 = $db->sql_query($sql2);
}
// Remove Backup Timestamp
$sql = 'DELETE FROM ' . PREFIX . 'config WHERE config_name = \'ct_last_backup\'';
$result = $db->sql_query($sql);
$template->assign_block_vars('ok', array());
} else {
if ($mode == 'psrt') {
$sql = "UPDATE " . PREFIX . "config SET\n\t\t\t\tconfig_value = '" . $db->sql_escape($HTTP_POST_VARS['cookie_name']) . "'\n\t\t\t\tWHERE config_name = 'cookie_name'";
$result = $db->sql_query($sql);
$sql = "UPDATE " . PREFIX . "config SET\n\t\t\t\tconfig_value = '" . $db->sql_escape($HTTP_POST_VARS['cookie_path']) . "'\n\t\t\t\tWHERE config_name = 'cookie_path'";
$result = $db->sql_query($sql);
$sql = "UPDATE " . PREFIX . "config SET\n\t\t\t\tconfig_value = '" . $db->sql_escape($HTTP_POST_VARS['cookie_domain']) . "'\n\t\t\t\tWHERE config_name = 'cookie_domain'";
$result = $db->sql_query($sql);
$sql = "UPDATE " . PREFIX . "config SET\n\t\t\t\tconfig_value = '" . $db->sql_escape($HTTP_POST_VARS['cookie_secure']) . "'\n\t\t\t\tWHERE config_name = 'cookie_secure'";