PHP错误消息

时间:2015-04-03 12:01:47

标签: php mysql

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代码(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 个答案:

答案 0 :(得分:0)

你应该在mysql_query($ sql,$ link)中添加第二个参数。 你应该使用PDO而不是mysql扩展。