Changes between Version 10 and Version 11 of Docs/825gen2/Dev/Networking/PHP
- Timestamp:
- 11/28/23 08:29:34 (12 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Docs/825gen2/Dev/Networking/PHP
v10 v11 95 95 Following is a more advanced demo. This reads from an ID storage transaction table and also displays vehicle images associated with transactions. 96 96 97 ids.php 98 97 99 {{{ 98 100 <!DOCTYPE html> … … 116 118 $result = $conn->query($sql); 117 119 if($result->num_rows > 0) { 118 echo '<table><tr><th>Tran Num</th><th>date/time</th><th> Gross Wt</th><th>Tare Wt</th><th>Net Wt</th><th>Image</th></tr>';120 echo '<table><tr><th>Tran Num</th><th>date/time</th><th>Vehicle</th><th>Gross Wt</th><th>Tare Wt</th><th>Net Wt</th><th>Image</th><th>First pass</th></tr>'; 119 121 while($row = $result->fetch_assoc()) { 120 122 $tkt_num = $row['tkt_num']; 121 123 $datetime = $row['date'] . ' ' . $row['time']; 124 $veh = $row['truck']; 122 125 $gross = $row['gross']; 123 126 $tare = $row['tare']; 124 127 $net = $row['net']; 125 echo '<tr><td>' . $tkt_num . '</td><td>' . $datetime . '</td><td>' . $ gross . '</td><td>' . $tare . '</td><td>'. $net . '</td>';128 echo '<tr><td>' . $tkt_num . '</td><td>' . $datetime . '</td><td>' . $veh . '</td><td>' . $gross . '</td><td>' . $tare . '</td><td>'. $net . '</td>'; 126 129 $imgfile = sprintf("v%06d_1.jpg", $tkt_num); 127 130 $img = 'images/' . $imgfile; 128 if(!file_exists($img)) { 129 $imgfile = sprintf("v%06da_1.jpg", $tkt_num); 130 $img = 'images/' . $imgfile; 131 if(file_exists($img)) { 132 echo '<td><a href="' . $img . '"><img src="' . $img .'" width="128" height="96" ></a></td>'; 133 } else { 134 echo '<td></td>'; 131 135 } 136 $imgfile = sprintf("v%06da_1.jpg", $tkt_num); 137 $img = 'images/' . $imgfile; 132 138 if(file_exists($img)) { 133 echo '<td><a href="' . $img . '"><img src="' . $img .'" width="128" height="96" ></a></td> </tr>';139 echo '<td><a href="' . $img . '"><img src="' . $img .'" width="128" height="96" ></a></td>'; 134 140 } else { 135 echo '<td> no image</td>';141 echo '<td></td>'; 136 142 } 143 echo '</tr>'; 137 144 } 138 145 echo '</table>';