2015-04-03 118 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的扩展。