當前位置: 首頁>>代碼示例>>PHP>>正文


PHP sql_db::sql_escape方法代碼示例

本文整理匯總了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'];
開發者ID:ALTUN69,項目名稱:icy_phoenix,代碼行數:30,代碼來源:convert_utf8.php

示例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'";
開發者ID:ALTUN69,項目名稱:icy_phoenix,代碼行數:31,代碼來源:emergency.php


注:本文中的sql_db::sql_escape方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。