2015-04-03 134 views
-1
PHP Error Message 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a6397779/public_html/app/ta.phtml on line 11 

Free Web Hosting 

......................................... ......................................PHP錯誤信息

這是PHP代碼(ta。 phtml文件):

<?php 
include('app/config.php'); 
$link = mysql_connect($AppConfig['db']['host'],$AppConfig['db']['user'],$AppConfig['db']['password']) or die(mysql_error()); 
mysql_select_db($AppConfig['db']['database'],$link) or die(mysql_error()); 
?> 

<?php 

$this->myData['id'] = $this->player->playerId; 
$result = mysql_query("SELECT Club,gold_num,Adventures,total_people_count FROM p_players where id='".$this->myData['id']."'"); 
while($row = mysql_fetch_array($result)) 
    { 
$Club = $row['Club']; 
$goldClub = $row['gold_num']; 
$Adventures = $row['Adventures']; 
$total = $row['total_people_count']; 
    } 

?> 

....................................... .........................

請幫忙!!

+1

首先你使用不推薦的** mysql **嘗試使用** PDO **或** mysqli ** – 2015-04-03 12:04:52

+0

使用$ query =「SELECT Club,gold_num,Adventures,total_people_count FROM p_players where id = $ this-> myData ['ID']」; – Saty 2015-04-03 12:05:40

+0

請在提問前查詢。這對於這些常見問題尤爲重要。 – hakre 2015-04-03 12:18:24

回答

0

您應該在mysql_query($ sql,$ link)中添加第二個參數。 你應該使用PDO來代替mysql的擴展。