Question : FPDF Multiple Images from MySQL

In lines 201-208 I am running a query to pull the file name of an image stored in MySQL then output to FPDF.  I am getting one picture(there should be 3) output but the query has the photo_loc_id pulling and all 3 photo_loc_id's are printing but not the corresponding photos.  Any clue at what I am doing wrong here.  Thank you.  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
<?php
require('fpdf.php');
class PDF extends FPDF
{
//Page header
function Header()
{
    //Move to the right
    $this->Cell(50);
    //Logo
    $this->Image('transconlogo12-12_jkqn.jpg',15,8,75);
    //Line break
    $this->Ln(20);
    //Arial bold 12
    $this->SetFont('Arial','B','U',12);
    //Move to the right
    $this->Cell(75);
    //Title
    $this->Cell(30,10,'PROPERTY INSPECTION FORM',0,0,'C');
}


//Page footer
function Footer()
{
    //Position at 1.5 cm from bottom
    $this->SetY(-15);
    //Arial italic 8
    $this->SetFont('Arial','I',8);
    //Page number
    $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}}

$pdf = new PDF();
$pdf->open();
$pdf->AddPage();
$pdf->AliasNbPages();   // necessary for x of y page numbers to appear in document
$pdf->SetAutoPageBreak(false);



// Add date report ran
$pdf->SetFont('Arial','I',10);
$date =  date("F j, Y");
$pdf->Cell(40,30,'Report date: '.$date);
 
$pdf->SetDrawColor(0, 0, 0); //black
 
//table header
$pdf->SetFillColor(170, 170, 170); //gray
$pdf->setFont("Arial","B","9");
$pdf->setXY(10, 40); 

 
$y = 50;
$x = 10;  
 
$pdf->setXY($x, $y);
 
$pdf->setFont("Arial","","9");
 
require_once('connvars.php');
require_once('prop_insp_form/photo_loc_vars.php');  
$dbc=mysqli_connect(db_host,db_user,db_password,db_name);

  $job_id=mysqli_real_escape_string($dbc,$_GET['job_id']);
 
$query_pdf = "SELECT job.*, prop_insp.*, listing_db.listing_db_name
FROM (job LEFT JOIN prop_insp ON job.job_id = prop_insp.job_id) LEFT JOIN listing_db ON job.listing_db_id = listing_db.listing_db_id 
where job.job_id='$job_id'
LIMIT 1";

$pdf_result = mysqli_query($dbc,$query_pdf) or die(mysql_error());
 
while($row = mysqli_fetch_array($pdf_result))
{
        $pdf->Cell(30, 4, "TC Number", 1, 0, "L", 1);
        $pdf->Cell(30, 4, $row['tc_number'], 1);
        $pdf->Cell(20, 4, "Client Name", 1, 0, "L", 1);
        $pdf->Cell(49, 4, $row['client_name'], 1);
        $pdf->Cell(25, 4, "Loan Number", 1, 0, "L", 1);
        $pdf->Cell(26, 4, $row['loan_number'],1);
        $pdf->Ln();
        $pdf->Cell(30, 4, "Property Address", 1, 0, "L", 1);
        $pdf->Cell(150, 4, $row['prop_addr_1'], 1);
        $pdf->Ln(); 
        $pdf->Cell(30, 4, "City", 1, 0, "L", 1);
        $pdf->Cell(40, 4, $row['prop_city'], 1); 
        $pdf->Cell(10, 4, "State", 1, 0, "L", 1);
        $pdf->Cell(10, 4, $row['prop_state'], 1);
        $pdf->Cell(10, 4, "Zip", 1, 0, "L", 1);
        $pdf->Cell(15, 4, $row['prop_zip'], 1);
        $pdf->Cell(20, 4, "County", 1, 0, "L", 1); 
        $pdf->Cell(45, 4, $row['prop_county'], 1);
        $pdf->Ln(); 
        $pdf->Ln();
        $pdf->Ln();
        $pdf->Cell(30, 4, "Listing Agent", 1, 0, "L", 1);
        $pdf->Cell(60, 4, $row['listing_agent'], 1);
        $pdf->Cell(30, 4, "Listing Office", 1, 0, "L", 1);
        $pdf->Cell(60, 4, $row['listing_office'], 1);
        $pdf->Ln(); 
        $pdf->Cell(50, 4, "The property is currently listed on ", 1, 0, "L", 1);
        $pdf->Cell(50, 4, $row['listing_db_name'], 1);
        $pdf->Cell(30, 4, "MLS Number", 1, 0, "L", 1);
        $pdf->Cell(50, 4, $row['mls_number'], 1);
        $pdf->Ln();
        $pdf->Cell(70, 4, "The property is currently listed on Realtor.com", 1, 0, "L", 1);
        $pdf->Cell(50, 4, $row['listed_realtor'], 1);
        $pdf->Ln();
        $pdf->Cell(30, 4, "Current List Price", 1, 0, "L", 1);
        $pdf->Cell(30, 4, $row['curr_price'], 1);
        $pdf->Cell(30, 4, "Previous List Price", 1, 0, "L", 1);
        $pdf->Cell(30, 4, $row['prev_price'], 1);
        $pdf->Cell(40, 4, "Date of Last Reduction", 1, 0, "L", 1);
        $pdf->Cell(20, 4, $row['dt_last_reduc'], 1);
        $pdf->Ln(); 
        $pdf->Ln();
        $pdf->Ln();
        $pdf->Cell(90, 4, "Is there a for sale sign visible from the street?", 1, 0, "L", 1);
        $pdf->Cell(50, 4, $row['sale_sign'], 1);
        $pdf->Ln();
        $pdf->Write(4, $row['sale_sign_comm']);
        $pdf->Ln();
        $pdf->Ln();
        $pdf->Cell(90, 4, "Are there any signs of vandalism?", 1, 0, "L", 1);
        $pdf->Cell(50, 4, $row['vandalism'], 1);
        $pdf->Ln();
        $pdf->Write(4, $row['vandalism_comm']);
        $pdf->Ln();
        $pdf->Ln();
        $pdf->Cell(90, 4, "Are there any visible code violations?", 1, 0, "L", 1);
        $pdf->Cell(50, 4, $row['code_viol'], 1);
        $pdf->Ln();
        $pdf->Write(4, $row['code_viol_comm']);
        $pdf->Ln();
        $pdf->Ln();
        $pdf->Cell(90, 4, "Are there any health and safety issues with the property?", 1, 0, "L", 1);
        $pdf->Cell(50, 4, $row['health_safe'], 1);
        $pdf->Ln();
        $pdf->Write(4, $row['health_safe_comm']);
        $pdf->Ln();
        $pdf->Ln();
        $pdf->Cell(90, 4, "Is the property secured?", 1, 0, "L", 1);
        $pdf->Cell(50, 4, $row['secure'], 1);
        $pdf->Ln();
        $pdf->Write(4, $row['secure_comm']);
        $pdf->Ln();
        $pdf->Ln();
        $pdf->Cell(90, 4, "Is the landscaping maintained?", 1, 0, "L", 1);
        $pdf->Cell(50, 4, $row['land_main'], 1);
        $pdf->Ln();
        $pdf->Write(4, $row['land_main_comm']);
        $pdf->Ln();
        $pdf->Ln();
        $pdf->Cell(90, 4, "Is the interior of the property clean?", 1, 0, "L", 1);
        $pdf->Cell(50, 4, $row['int_clean'], 1);
        $pdf->Ln();
        $pdf->Write(4, $row['int_clean_comm']);
        $pdf->Ln();
        $pdf->Ln();
        $pdf->Cell(90, 4, "Is the electricity turned on?", 1, 0, "L", 1);
        $pdf->Cell(50, 4, $row['electricity'], 1);
        $pdf->Ln();
        $pdf->Write(4, $row['electricity_comm']);
        $pdf->Ln();
        $pdf->Ln();
        $pdf->Cell(90, 4, "Is the electricity turned on?", 1, 0, "L", 1);
        $pdf->Cell(50, 4, $row['water'], 1);
        $pdf->Ln();
        $pdf->Write(4, $row['water_comm']);
        $pdf->Ln();
        $pdf->Ln();
        $pdf->Cell(170, 4, "If between September and April-Are there notices that the home has been winterized?  Please provide photos of notices", 1, 0, "L", 1);
        $pdf->Ln();
        $pdf->Cell(50, 4, $row['winterized'], 1);
        $pdf->Ln();
        $pdf->Write(4, $row['winterized_comm']);
        $pdf->Ln();
        $pdf->Cell(170, 4, "Please Provide any additional comments, such as, condition of neighboring homes, current real estate market conditions in the area.?", 1, 0, "L", 1);
        $pdf->Ln();
        $pdf->Write(4, $row['add_comm']);
        $pdf->Ln();
        $pdf->Write(4, $row['add_comm']);

      
 
        $y += 8;
        
        if ($y > 260)    // When you need a page break
		{
            $pdf->AddPage();
            $y = 40;
			
		}
        
        $pdf->setXY($x, $y);
}
$pdf->AddPage();

$photo_query = "SELECT * FROM photos
where photos.job_id='$job_id'";
$photo_result = mysqli_query($dbc,$photo_query) or die(mysql_error());
while($row = mysqli_fetch_array($photo_result))
{
$pdf->Cell(30, 4, $row['photo_loc_id'], 1);
$pdf->Image(PHOTO_UPLOADPATH. $row['photo_path'],15,8,75);
$pdf->Ln();
}

$pdf->Output();

$file = $row[mls_location];

if (file_exists($file)) {
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename='.basename($file));
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file));
    ob_clean();
    flush();
    readfile($file);
    exit;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN http: //www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">	
 </head>
  <body>
   <form enctype="multipart/form-data" method="POST" action="<?php echo $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']; ?>">
   </form>
  </body>

Answer : FPDF Multiple Images from MySQL

Ahh, I understand.  You can explicitly locate either "cells" or lines of text, via X-Y coordinates.  That should let you line up the data.  I do not know of any table layout, per se, like HTML tables.
Random Solutions  
 
programming4us programming4us