嗨,我有問題連接到我的數據庫`警告:mysql_query():拒絕用戶'peace4love'@'localhost'(使用密碼:否)/ home// home/peace4love/public_html中無法建立指向服務器的鏈接,請在/ home/peace4love/public_html中建立一個指向服務器的鏈接,然後在/ home/peace4love/public_html /ivegotdiamonds.com/wp-content/plugins/hsquare/config-new.php線14 錯誤,查詢failed`這裏是代碼:無法建立到服務器的鏈接Mysql
<?php
require_once(ABSPATH."/lib/myplug.php");
$objMem = new myPlug();
$table_name = "h_config";
[email protected]$_POST["addme"];
global $wpdb;
$act=$_REQUEST["act"];
if($act=="upd")
{
$recid=$_REQUEST["id"];
$sSQL="select * from ".$table_name." where config_id=$recid";
$result = mysql_query($sSQL) or die ('Error, query failed');
if (mysql_num_rows($result) > 0)
{
if($row = mysql_fetch_assoc($result))
{
$id = $row['config_id'];
$c_key = $row['c_key'];
$c_value = $row['c_value'];
$c_index = $row['c_index'];
$c_record = $row['c_record'];
$c_record_2 = $row['c_record_2'];
$c_record_3 = $row['c_record_3'];
$c_record_4 = $row['c_record_4'];
$btn = "Update Record";
$hidval = 32;
}
}
}
else
{
$btn ="Add New Record";
$c_key = "";
$c_value = "";
$c_index = "";
$c_record = "";
$c_record_2 = "";
$c_record_3 = "";
$c_record_4 = "";
$btn = "Add New Record";
$hidval = 31;
}
>
如果我需要猜測,我會說你沒有配置用戶訪問數據庫的用戶peace4love從本地主機。 – Miki 2014-09-23 20:55:42
我在代碼中的任何地方缺少一個'mysql_connect',是否在別處調用? – favoretti 2014-09-23 20:58:38
這是一個不同網站的數據庫。 – user2986348 2014-09-23 20:59:10