舊的查詢用於獲取管理員存儲在數據庫中的網站設置,如MyCompanyName或版權文本。這些是由管理員在後臺添加的。如何更改PHP腳本以使用PDO?
<?php
error_reporting (E_ALL^E_NOTICE);
include("connection.php");
include('english.php');
include("admin/include/function.php");
$query_general_setting=mysql_fetch_array(mysql_query("select * from general_setting where id=1 and g_id=1"));
if(basename(url())!="index.php" or basename(url())!="index.php?log=1"){
$explode_permistion=explode(",",$_SESSION['area_permistion']);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta name="viewport" content="width=device-width, maximum-scale=1, initial-scale=1, user-scalable=0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<link href='http://fonts.googleapis.com/css?family=Exo+2&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
<link href="center/css/jquery/jquery-ui-1.10.3.custom.css" media="screen" rel="stylesheet" type="text/css" />
<link href="center/css/center.css" media="screen" rel="stylesheet" type="text/css" />
<title><?php echo $query_store_setting['s_title'];?></title>
<meta name="description" content="<?php echo $query_store_setting['s_description'];?>">
<meta name="keywords" content="<?php echo $query_store_setting['s_keywords'];?>">
<link rel="stylesheet" href="style.css">
</head>
更改爲這並沒有太大的幫助:
$query_store_setting = $conn->query('SELECT * FROM general_setting WHERE id=1 and g_id=1')->fetchAll();
你只能用這個1項紀錄查詢? – Alex 2015-02-24 16:55:13
http://code.tutsplus.com/tutorials/php-database-access-are-you-doing-it-correctly--net-25338 – EddyTheDove 2015-02-24 16:55:30
我修復了未正確格式化的隱藏代碼。請學習如何使用這裏的格式化工具 - 您只需選擇您的代碼並按代碼按鈕。甚至有預覽窗格,所以沒有理由發佈無格式的代碼。 – halfer 2015-02-24 17:09:35