i am trying to generate pdf file using fpdf selecting data from two different tables i.e. table custreg and table slabpay, but getting MySQL error: "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in D:\inetpub\vhosts\kisan.net\httpdocs\greengold\exportpdf.php on line 124".

Code:

$strSQL = "SELECT custreg.mobno1, slabpay.ac_no, slabpay.cust_name, slabpay.install_no, GROUP_CONCAT(`slabpay.install_amt` ORDER BY `slabpay.install_no` SEPARATOR ' | ') as installamt FROM slabpay,custreg WHERE slabpay.agent_id=$agentid AND custreg.magentid=$agentid GROUP BY slabpay.ac_no";
$objQuery = mysql_query($strSQL);
$resultData = array();
for ($i=0;$i<mysql_num_rows($objQuery);$i++) {
    $result = mysql_fetch_array($objQuery);
    array_push($resultData,$result);
}

help me to fix this issue

This mostly happnes when query do not run

I guess you $agentid is not set properly

print query on browser
copy it and run into phpmyadmin, and
check and solver any error there

$strSQL = "SELECT custreg.mobno1, slabpay.ac_no, slabpay.cust_name, slabpay.install_no, GROUP_CONCAT(`slabpay.install_amt` ORDER BY `slabpay.install_no` SEPARATOR ' | ') as installamt FROM slabpay,custreg WHERE slabpay.agent_id=$agentid AND custreg.magentid=$agentid GROUP BY slabpay.ac_no";

echo $strSQL;
die('stop for now');
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.