lional Posted October 8, 2008 Share Posted October 8, 2008 I have two sites one for testing and one is the live site. on the testing site everything works fine but one the live site I get this error FPDF error: Some data has already been output, can't send PDF file What I don't understand is that it is the same code on both sites Here is the pdf page <?php session_start(); $refer = $_SESSION['ref']; include 'includes/conn_db.php'; $query_cl = "SELECT * from config"; $result_cl = mysql_query($query_cl, $conn); while ($row_cl = mysql_fetch_assoc($result_cl)){ $client_name_out = $row_cl["client_name"]; $address_out = $row_cl["address"]; $suburb_out = $row_cl["suburb"]; $city_out = $row_cl["city"]; $postal_address_out = $row_cl["postal_address"]; $postal_code_out = $row_cl["postal_code"]; $tel_out = $row_cl["tel"]; $fax_out = $row_cl["fax"]; $vat_no_out = $row_cl["vat_no"]; $mail_out = $row_cl["mail"]; $url_out = $row_cl["url"]; $image_out = $row_cl["image"]; } $query_name = "SELECT * from orders WHERE ref_no = '$refer'"; $result_name = mysql_query($query_name, $conn); while ($row_name = mysql_fetch_assoc($result_name)){ $client_id_out = $row_name["client_id"]; $cl_order_out = $row_name["cl_order"]; $sub_total_out = $row_name["sub_total"]; $postage_out = $row_name["postage"]; $vat_out = $row_name["vat"]; $total_out = $row_name["total"]; $order_date_out = $row_name["order_date"]; $final_cl_order = 'Your Order No. ' . $cl_order_out; } $query_client = "SELECT * from clients WHERE client_id = '$client_id_out'"; $result_client = mysql_query($query_client, $conn); while ($row_client = mysql_fetch_assoc($result_client)){ $company_out = $row_client["company"]; $type_of_bus_out = $row_client["type_of_bus"]; $bus_reg_no_out = $row_client["bus_reg_no"]; $bus_vat_no_out = $row_client["bus_vat_no"]; $deladd1_out = $row_client["deladd1"]; $deladd2_out = $row_client["deladd2"]; $del_suburb_out = $row_client["del_suburb"]; $del_city_out = $row_client["del_city"]; $del_province_out = $row_client["del_province"]; $del_code_out = $row_client["del_code"]; $tel_out = $row_client["tel"]; $fax_out = $row_client["fax"]; $email_out = $row_client["email"]; $price_group_out = $row_client["price_group"]; } $fullname = $firstname_out . " " . $surname_out; $order_no_final = 'ORDER No. ' . $refer; require('fpdf.php'); $pdf=new FPDF(); $pdf->AddPage(); $pdf->SetFont('Arial','B',14); $pdf->cell(50,60,'',0,1,'C'); $pdf->SetFont('Arial','',10); $pdf->settextcolor(0,0,0); $pdf->SetFont('Arial','',10); $pdf->Image('images/logo_order.jpg',2,2,0,0,'',''); $pdf->text(15,32,$company_out,0,0); $pdf->text(15,36,$deladd1_out,0,0); $pdf->text(15,40,$deladd2_out,0,0); $pdf->text(15,44,$del_suburb_out,0,0); $pdf->text(15,48,$del_city_out,0,0); $pdf->text(15,52,$del_province_out,0,0); $pdf->text(15,56,$tel_out,0,0); $pdf->text(15,65,$order_date_out,0,0); $pdf->SetFont('Arial','B',10); $pdf->SetFont('Arial','',10); $pdf->text(150,36,'P. O. Box 82168',0,0); $pdf->text(150,40,'Southdale',0,0); $pdf->text(150,44,'Johannesburg',0,0); $pdf->text(150,52,'2135',0,0); $pdf->SetFont('Arial','B',14); $pdf->text(80,40,$order_no_final,0,1,0); $pdf->text(80,50,$final_cl_order,0,1,0); $pdf->SetFont('Arial','',10); $pdf->SetFillColor(255,255,255); $pdf->settextcolor(0,0,0); $pdf->cell(10,5,'Qty',1,'','C',1,''); $pdf->cell(30,5,'Code',1,'','C',1,''); $pdf->cell(100,5,'Product',1,'','C',1,''); $pdf->cell(20,5,'Unit Price',1,'','C',1,''); $pdf->cell(25,5,'Line Total',1,'1','C',1,''); $query = "SELECT * from line_items WHERE ref_no = '$refer'"; $result = mysql_query($query, $conn); while ($row = mysql_fetch_assoc($result)){ $prod_id_out = $row["prod_code"]; $qty_out = $row["qty"]; $date_out = $row["date"]; $query1 = "SELECT * from products WHERE prod_id = '$prod_id_out'"; $result1 = mysql_query($query1, $conn); while ($row1 = mysql_fetch_assoc($result1)){ $prod_code_out = $row1["prod_code"]; $prod_name_out = $row1["prod_desc"]; if ($price_group_out == 1) { $unit_cost_out = $row1['price1']; } if ($price_group_out == 2) { $unit_cost_out = $row1['price2']; } if ($price_group_out == 3) { $unit_cost_out = $row1['price3']; } if ($price_group_out == 4) { $unit_cost_out = $row1['price4']; } if ($price_group_out == 5) { $unit_cost_out = $row1['price5']; } $list_cost = $unit_cost_out; } $lt = $list_cost * $qty_out; $lt = number_format($lt, 2, '.', ''); $pdf->SetFont('Arial','B',9); $pdf->cell(10,5,$qty_out,'RTLB','','C',1,''); $pdf->cell(30,5,$prod_code_out,'RTLB','','C',1,''); $pdf->cell(100,5,$prod_name_out,'RTLB','','L',1,''); $pdf->cell(20,5,$list_cost,'RTLB','','R',1,''); $pdf->cell(25,5,$lt,'RTLB','1','R',1,''); } $pdf->SetFont('Arial','B',10); $pdf->cell(160,5,'Subtotal',T,'','R',1,''); $pdf->cell(25,5,$sub_total_out,'1',1,'R',1,''); $pdf->cell(160,5,'Postage',0,'','R',1,''); $pdf->cell(25,5,$postage_out,'1',1,'R',1,''); $pdf->cell(160,5,'VAT',0,'','R',1,''); $pdf->cell(25,5,$vat_out,'1',1,'R',1,''); $pdf->cell(160,5,'Total',0,'','R',1,''); $pdf->cell(25,5,$total_out,'1','1','R',1,''); $pdf->cell(100,10,'',0,1,'L'); $pdf->cell(100,10,'Authorized By: ',0,1,'L'); $pdf->Output(); ?> Link to comment https://forums.phpfreaks.com/topic/127529-pdf-problem/ Share on other sites More sharing options...
waynew Posted October 8, 2008 Share Posted October 8, 2008 Something somewhere is being outputted. Check the source of the generated page. Link to comment https://forums.phpfreaks.com/topic/127529-pdf-problem/#findComment-659815 Share on other sites More sharing options...
lional Posted October 8, 2008 Author Share Posted October 8, 2008 But why will it run on the one site and not the other Link to comment https://forums.phpfreaks.com/topic/127529-pdf-problem/#findComment-659832 Share on other sites More sharing options...
waynew Posted October 8, 2008 Share Posted October 8, 2008 What did the HTML source of your page say? Link to comment https://forums.phpfreaks.com/topic/127529-pdf-problem/#findComment-659837 Share on other sites More sharing options...
lional Posted October 8, 2008 Author Share Posted October 8, 2008 FPDF error: Some data has already been output, can't send PDF file But both sites reside on the same server, same code except one works and the other one gives an error Link to comment https://forums.phpfreaks.com/topic/127529-pdf-problem/#findComment-659845 Share on other sites More sharing options...
waynew Posted October 8, 2008 Share Posted October 8, 2008 Are you completely sure that nothing is caught in between tags? That's why I said check your source. Link to comment https://forums.phpfreaks.com/topic/127529-pdf-problem/#findComment-659850 Share on other sites More sharing options...
lional Posted October 8, 2008 Author Share Posted October 8, 2008 I am just pulling data from mysql and then outputting it to pdf What baffles me is that it works on wamp, a site called www.webtest.co.za which is Linux but not on my other site. All identical code Link to comment https://forums.phpfreaks.com/topic/127529-pdf-problem/#findComment-659857 Share on other sites More sharing options...
waynew Posted October 8, 2008 Share Posted October 8, 2008 Have a look see: http://fmwebschool.com/frm/index.php?topic=2585.0 Link to comment https://forums.phpfreaks.com/topic/127529-pdf-problem/#findComment-659859 Share on other sites More sharing options...
JonnoTheDev Posted October 8, 2008 Share Posted October 8, 2008 Just check the page source like suggested. Its obviously a stray whitespace or something being outputted. Ive had this error tons of times. Link to comment https://forums.phpfreaks.com/topic/127529-pdf-problem/#findComment-659864 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.