Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8896245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:59:27+00:00 2026-06-14T23:59:27+00:00

I am attempting to build a PDF based on the information in a database

  • 0

I am attempting to build a PDF based on the information in a database that I have. I am getting a 500 internal server error when I do. The code that is throwing the error is:

<?php
include('db.php');

    $pdfArray = array();

    $top = '<h1>Med One Equipment List</h1>
            <table>
            <thead>
                <tr>
                    <td>Manufacturer</td>
                    <td>Model</td>
                    <td>Description</td>
                </tr>
            </thead>
            <tbody>
        ';
        array_push($pdfArray, $top);

    while($rowAll = mssql_fetch_array($allResult)) {
        $html = '
        <tr>
            <td>'.$rowAll["Manufacturer"].'</td>
            <td>'.$rowAll["Model"].'</td>
            <td>'.$rowAll["Make"].'</td>
        <tr>';
        array_push($pdfArray, $html);
    }

    $bottom = '</tbody>
                </table>';

    array_push($pdfArray, $bottom);

    $table = implode(" ", $pdfArray);

    $html =  <<<EOF 
    {$table} 
    EOF;
?>

I am just including this file when I build my PDF with TCPDF. Let me know if I need to include some of the TCPDF code. I can’t for the life of my figure out why it won’t work. My guess is that I’m using herdoc incorrectly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T23:59:29+00:00Added an answer on June 14, 2026 at 11:59 pm

    From looking at the raw formatting of your code, it looks like

    $html =  <<<EOF
    {$table} 
    EOF;
    

    is indented with a tab. If that is the case in your real code, the problem is that the end of a heredoc must be the first thing on a line. If it is indented at all, it will break. So if your code is indented, it will need to look something like this:

    if($example_block){
        $html =  <<<EOF
        {$table} 
    EOF;
    
        {other indented code}
    }
    

    P.S. The observations about the indenting with a tab I mentioned above were from before the question was edited, but wither way, if it is indented with a tab or spaces, it will break. Also, Kyle is is correct in stating that the opening identifier must also be immediately followed by a new line.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Attempting to build an interface and generics based graph and getting an odd error
I'm attempting to build a method call from strings that have been passed into
I'm attempting to build some C++ code that requires the Windows 7.0 SDK header
I am attempting to build a website that utilizes facebook auth based setting created
I am attempting to build google-breakpad and I am getting the error File C:\google-breakpad\src\tools\gyp\pylib\gyp\generator\msvs.py,
Attempting to build a C# NPAPI plugin I have found a tutorial which describes
I am attempting to build a backup script that moves a tar file from
I'm attempting to build Firefox on my Windows Vista Ultimate machine. I keep getting
When attempting to build a c++ program containing the following code: menutype::menutype(int cat_num){ extras
I'm attempting to build a login page for my website. I have managed to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.