[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 983
  • Last Modified:

FPDF image from MySQL major problem

Hello experts!

I am trying to create a pdf from data stored in mysql database. When trying to create the header I cannot get the image from mysql to display.

The image does exist and I can see it if I type the url directly. If I echo $row_search_results['main_photo']
it shows me the correct filename IMG_0791.JPG

But I get the following error if I just try and create the pdf.

Warning: getimagesize() [function.getimagesize]: Filename cannot be empty in /home/survey/public_html/property/fpdf/fpdf.php  on line 1202
FPDF error: Missing or incorrect image file:

If I hard code the image it works fine.

Please help!
Many thanks
$logo = "property_images/".$row_search_results['main_photo']; 


class PDF extends FPDF
//Page header
function Header()

Open in new window

1 Solution
dovercomputersAuthor Commented:
Fixed it myself.

Must declare glabal variable for use in header function.

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now