lukelee Posted November 14, 2008 Share Posted November 14, 2008 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> Quote Link to comment Share on other sites More sharing options...
DarkerAngel Posted November 14, 2008 Share Posted November 14, 2008 <?php require_once('db.php'); $query = mysql_query("SELECT * FROM image WHERE thumb = '1'"); while($row = mysql_fetch_assoc($query)) { ?> <ul> <li><img src="upload/<?PHP echo $row['imagedata']; ?>" /></li> <li></li> </ul> <?php } ?> Something close to that? Quote Link to comment Share on other sites More sharing options...
lukelee Posted November 14, 2008 Author Share Posted November 14, 2008 oh, yes! bro. thats it. thanks! hey, by the way, how to resize the image? I tryed to make <li style="width:105px"> but seems not working. Quote Link to comment Share on other sites More sharing options...
DarkerAngel Posted November 14, 2008 Share Posted November 14, 2008 <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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.