0

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

Edited by blueguy777: some change in code

2
Contributors
1
Reply
14
Views
3 Years
Discussion Span
Last Post by urtrivedi
0

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');

Edited by urtrivedi

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.