Jump to content

Newbie PHP Help - Echo Images


jonesypeter
Go to solution Solved by ZulfadlyAshBurn,

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
Share on other sites

  • Solution
// 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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.