Jump to content

Newbie PHP Help - Echo Images


jonesypeter

Recommended Posts

Hi,

 

I'm trying to display some records from a MySQL database which worked fine.  I have now changed the code to display in image and I seem to have broken it. Could anybody help me sort this out?

 

Many thanks

 

Peter Jones

 

 

// Table header.
echo '<table align="center" cellspacing="3" cellpadding="3" width="75%">
<tr><td align="left"><b>Title</b></td><td align="left"><b>Publisher</b></td><td align="left"><b>Release Year</b></td></tr>
';
 
// Fetch and print all the records:
while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) {
echo '<tr><td align="left"><img src="/images/spectrum/game/' . $row['image'] . '" alt="some_text">' . '</td><td align="left">' . 
                $row['publisher'] . '</td><td align="left">' . $row['rel_year'].   '</td></tr>
}
 
echo '</table>'; // Close the table.

 

Link to comment
https://forums.phpfreaks.com/topic/277386-newbie-php-help-echo-images/
Share on other sites

// Table header.
echo '<table align="center" cellspacing="3" cellpadding="3" width="75%">
<tr><td align="left"><b>Title</b></td><td align="left"><b>Publisher</b></td><td align="left"><b>Release Year</b></td></tr>
';


// Fetch and print all the records:
while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) {
echo '<tr><td align="left"><img src="/images/spectrum/game/' . $row["image"] . '" alt="some_text">' . '</td><td align="left">' . $row["publisher"] . '</td><td align="left">' . $row["rel_year"].   '</td></tr>';
}


echo '</table>'; // Close the table.

try this?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.