Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'mysql php fpdf invoice'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 1 result

  1. Hi there everyone. In this book Larry uses PayPal as a payment solution. I have different needs as my site will not work with a payment service. I want to output MYSQL data onto a PDF using the FPDF Library. I have looked around on the web and can't seem to find a understandable solution. Will somebody please help me with this? This solution below works perfectly with a text file, but I want a user to retrieve their monthly invoice by the click of a button. The .txt source must thus be substituted with MYSQL data. The problem is when I query MYSQL as usual, it gives the following error: FPDF error: Some data has already been output, can't send PDF file. Can anybody over here please help me with a workable solution? Thank you in advance! My Code is as follows: My Current data load function which usually takes a .txt file as parameter: function LoadData($file) { $lines = file($file); $data = array(); foreach($lines as $line) $data[] = explode(';',trim($line)); return $data; } This is a piece of my fpdf.php library which creates the columns: function ImprovedTable($header, $data) { $this->Ln(15); $this->SetFontSize(11); $w = array(20, 90, 20, 12, 50); // Header for($i=0;$i<count($header);$i++) $this->Cell($w[$i],7,$header[$i],1,0,'C'); $this->Ln(); // Data foreach($data as $row) { $this->SetFontSize(9); $this->Cell($w[0],9,$row[0],'LR',0,'C'); $this->Cell($w[1],9,$row[1],'LR',0,'C'); $this->Cell($w[2],9,$row[2],'LR',0,'C'); $this->Cell($w[3],9,$row[3],'LR',0,'C'); $this->Cell($w[4],9,$row[4],'LR',0,'C'); $this->Ln(); } // Closing line $this->Cell(array_sum($w),0,'','T'); } This is where the PDF is created. Here I'm still using the text file to get my data but want to use data from my table: $pdf=new PDF(); // Column headings $header = array('Ref #', 'Headline', 'Cost', 'Month', 'Date of transaction'); // Data loading $data = $pdf->LoadData('invoice.txt'); $pdf->SetFont('Arial','',14); $pdf->AddPage(); $pdf->ImprovedTable($header,$data); $pdf->Output(); This is the SQL Query that I tried to include in my PDF creater. The database connection is also include I have not added it here however, so that is not the problem. $query_database = "SELECT * FROM invoices WHERE user_number = '10'"; $connected_query = mysqli_query($connect_to_database, $query_database); while ($result = mysqli_fetch_array($connected_query)) { $invoice_data[] = $result; } foreach($invoice_data as $data);
×
×
  • Create New...