Jump to content

[SOLVED] Image Tags


bmdsherman

Recommended Posts

Not with html alone.

 

Hmm, what about with php?

The code around the image is:

<?php
while($row = mysql_fetch_assoc($result)){  echo "<center>
<table border='0' cellspacing='2' cols='2' frame='void' rules='none'>
  <colgroup>
  <col width='350'>
  <col width='350'>
  <col width='350'>
  </colgroup>
  <tbody>

    <tr>
      <td><center><a href=profile.php?p={$row['id']}>{$row['fname']} {$row['lname']}</a></center></td>
      <td><center><a href=mailto:{$row['email']}>{$row['email']}</a></center></td>
      <td><center><img src={$row['img']}></center></td>
    </tr>
    </tbody>
</table>";
  }

Link to comment
Share on other sites

$src = (is_file($row['img'])) ? $row['img']: "somethingelse.jpg";
<td><center><img src={$src}></center></td>

 

You will have to play with that.

 

Also, you should be putting double quotes around your html attributes. So instead of:

 

<img src=something

 

you have

<img src="something"

Link to comment
Share on other sites

Also, you should be putting double quotes around your html attributes. So instead of:

 

<img src=something

 

you have

<img src="something"

 

Ya I know I'm cheating but I'm using double quotes for the php echo because variables aren't picked up in single quotes.

 

 

Thanks for your help!

Link to comment
Share on other sites

It's not a problem with cheating, it's a problem that your code won't work properly in some browsers. It also won't be valid.

 

You have a choice, either escape your quotes inside the double quotes:

 

echo "<img src=\"$row['img']\" />";

 

Or preferably exit out of your quotes and put in the value:

 

echo '<img src="' . $row['img'] . '" />';

 

The second one being more efficient when processing.

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.