This question already has an answer here:
I make a php page in which i want to get data from database but when i run it gives me the warning "mysql_num_rows() expects parameter 1 to be resource".
How i remove this warning?
Here is my code:
$strQuery1 = "select DATE_FORMAT(transactions.transaction_date,'%m-%d-%Y') as transaction_date,sum(amount)as Amount from transactions where event_id='7' group by DATE_FORMAT(transactions.transaction_date,'%m-%d-%Y')";
$result1 = $GLOBALS ['mysqli']->query ($strQuery1) or die ($GLOBALS ['mysqli']->error . __LINE__);
$rows=mysql_num_rows($result1);
while($rs1=$result1->fetch_assoc()){
$res1[]=$rs1;
}
for ($i = 0 ; $i <=30 ; $i++) {
foreach($res1 as $r){
if($r['transaction_date']==$dates[$i]){
$substrXML1= "<set value='" . $r['Amount'] ."' />";
break;
} else
{
$substrXML1= "<set value='0' />";
}
}
$strXML1 .=$substrXML1;
}
$strXML1.="</dataset>";
</div>