Jump to content

questions about how to display multiple pictures which are from database?


lukelee

Recommended Posts

here is my database looks like:

 

pid          title          thumb          imagedata

 

1            house            1              4352fdase234.jpg

2            farm              2              423fdsg43tghgh45.jpg

1            bed              1              hytuy56retgy4.jpg

1            hotel            1              554thser4fs.jpg

 

I want to display all the images which have thumb=1.

 

I can only make it display 1 image, here is my code. can anyone teach me how to display all thumb=1 images on a row? thanks

 

  <?PHP
require_once('db.php');
$query = mysql_query("SELECT * FROM image WHERE thumb = '1'");
$row = mysql_fetch_array($query);
?>
<ul>
<li><img src="upload/<?PHP echo $row['imagedata']; ?>" /></li>
<li></li>
</ul>

Link to comment
Share on other sites

<img height="xx" (or width="xx") src="[file]" />

 

Most modern browsers now will lock the ratio of the image to prevent distortion (if only one size restriction is placed,) if it's possibly going to be used in older browsers you may want to think about a script to create the height/width calculation or a script to create thumbnails.

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.