我是初學者。 我的服務器網絡http://www.barman-team.ir/tt.php 上覆制一個簡單的PHP頁面,我導入SQL數據庫,使用戶&和傳遞(在的cPanel)本地主機(XAMP)上警告:mysql_connect():拒絕用戶訪問
此頁的數據的基礎上,但不要在服務器上運行
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<body dir="rtl">
<?php
$link=mysql_connect("localhost","uname","pass");
mysql_select_db("barmante_ebram",$link);
$q="SELECT * FROM site_sug";//
$r=mysql_query($q,$link);
$line= mysql_fetch_array($r);
//while($line== $result->fetch_assoc()){
echo $line['site_suggestion_id'].$line['site_suggestion']."<br>";
//echo $row["site_suggestion_id"].$row["site_suggestion_name"].$row["site_suggestion_date"].$row["site_suggestion"]."<br>";
//}
?>
</body>
</html>
錯誤日誌:
Warning: mysql_connect(): Access denied for user 'barmante_ebram_u'@'localhost' (using password: YES) in /home/barmante/public_html/tt.php on line 11
Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in /home/barmante/public_html/tt.php on line 12
Warning: mysql_query() expects parameter 2 to be resource, boolean given in /home/barmante/public_html/tt.php on line 14
Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in /home/barmante/public_html/tt.php on line 15
有什麼不清楚的錯誤信息?您的實時環境需要與測試環境不同的用戶名和/或密碼。 – Quentin
**警告**:您正在使用[an **過時的**數據庫API](http://stackoverflow.com/q/12859942/19068),並應使用[現代替換](http:// php。淨/手動/ EN/mysqlinfo.api.choosing.php)。 – Quentin