Hi I was doing some query in php file
<?php
include_once('Query.Class.php');
@session_start();
$idPlayer = $_SESSION['ID_PLAYER'];
$obj = new Query();
$playerData = $obj->getPlayerData($idPlayer);
?>
<?php
echo "<a href=profile.php?id=".$playerData['ID_PLAYER'].">".$playerData['USERNAME']."</a>";?></h1>
<?php
$playerMoney = $obj->getPlayerMoney($idPlayer);
for($i = 1; $i <= count($playerMoney); $i++){
echo"
<tr>
<td width='20' align='left'>".$playerMoney[$i]['CURENCY_NAME']."</td>
<td width='10'>:</td>
<td width='70' align='left'>".$playerMoney[$i]['CURENCY_AMMOUNT']."</td>
</tr>";
}
?>
<?php
$playerInventory = $obj->getPlayerInventory($idPlayer);
for($i = 1; $i <= count($playerInventory); $i++){
echo"
<tr>
<td width='20' align='left'>".$playerInventory[$i]['ITEMS_NAME']."</td>
<td width='10'>:</td>
<td width='70' align='left'>".$playerInventory[$i]['QUANTITY']."</td>
</tr>";
}
this is Query.php
<?php
include_once('Connection.Class.php');
class Query{
private $connection;
public function Query(){
$this->connection = new Connection();
}
public function executeQuery($str){
$this->connection->connect();
$result = mysql_query($str);
if(!$result){
$this->connection->disconnect();
return false;
}
else{
$this->connection->disconnect();
return $result;
}
}
public function newExecuteQuery($str){
$this->connection->connect();
$result = mysql_query($str);
if($result){
$this->connection->disconnect();
return $result;
}
else{
$this->connection->disconnect();
return false;
}
}
public function login($username,$password,$ip_adreess){
$username = addslashes($username);
$md5Password = md5($password);
$str = "CALL sp_login('$username','$md5Password','$ip_adreess')";
$result = $this->executeQuery($str);
if(mysql_num_rows($result)>0){
$row_array = mysql_fetch_array($result);
return $row_array;
}
else{
return false;
}
}
public function getIDPlayer($username,$password){
$username = addslashes($username);
$md5Password = md5($password);
$str = "CALL sp_getPlayerData('$username','$md5Password')";
$result = $this->executeQuery($str);
if(mysql_num_rows($result)>0){
$row_array = mysql_fetch_array($result);
return $row_array;
}
else{
return false;
}
}
public function getPlayerData($idPlayer){
$str="SELECT * FROM player where ID_PLAYER = '$idPlayer'";
$result = $this->executeQuery($str);
if(mysql_num_rows($result)>0){
$row_array = mysql_fetch_array($result);
return $row_array;
}
else {
return false;
}
}
public function getPlayerMoney($idPlayer){
$str="CALL sp_getPlayerMoney($idPlayer)";
$i =1;
$result_array = array();
$result = $this->executeQuery($str);
while($row = mysql_fetch_array($result)){
$result_array[$i]['CURENCY_ID']=$row['CURENCY_ID'];
$result_array[$i]['CURENCY_AMMOUNT']=$row['CURENCY_AMMOUNT'];
$result_array[$i]['CURENCY_NAME'] = $row['CURENCY_NAME'];
$i++;
}
return $result_array;
}
public function getPlayerInventory($idPlayer){
$str="CALL sp_getPlayerInventory($idPlayer)";
$i =1;
$result_array = array();
$result = $this->executeQuery($str);
while($row = mysql_fetch_array($result)){
$result_array[$i]['ITEMS_NAME']=$row['ITEMS_NAME'];
$result_array[$i]['ITEMS_ID']=$row['ITEMS_ID'];
$result_array[$i]['QUANTITY'] = $row['QUANTITY'];
$i++;
}
return $result_array;
}
}
?>
I got below Error:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\City\index\Query.Class.php on line 88
in invectory section. but when i delete query for money, query for inventory will return true
any help ?