Hi all,
I am having a problem with the code below. When I run it I get the error:
Warning: Invalid argument supplied for foreach() in /var/www/vhosts/baggagepin.com/httpdocs/sales_report.php on line 85
FPDF error: Some data has already been output, can't send PDF file
I am trying to run the QUERY and extract the data that matches the variable "$ecndi". The code I am working on is:
$ecnid = 1;
mysql_select_db($database_pin, $pin);
$query_comm = sprintf("SELECT c.code, c.begin_date,c.expire_date,c.discount,c.member_id,c.product_id,c.used_count,
c.saleprice,c.coupon_id,c.paid,p.payment_id,p.member_id,p.coupon_id,p.completed,p.time,p.amount, p.product_id,
p.p_discount, p.comm_paid, p.d_paid, m.member_id, m.agentrate
FROM coupon c ,payments p, members m
WHERE c.coupon_id = " . $ecnid . "
AND c.coupon_id = p.coupon_id
AND m.member_id = %s
AND p.completed = 1
AND p.comm_paid = 0
ORDER BY p.payment_id");
$comm = mysql_query($query_limit_comm, $pin) or die(mysql_error());
$row_comm = mysql_fetch_assoc($comm);
define('FPDF_FONTPATH','/var/www/vhosts/mydomain/httpdocs/fonts/');
require('fpdf.php');
$vals1 = "";
class PDF extends FPDF
{
//Load data
function LoadData($file)
{
//Read file lines
$row_comm=file($query_comm);
$data=array();
foreach($row_comm as $line)
$data[]=explode(';',chop($line));
return $data;
}
Can anyone see where I am going wrong.