Hello I have a database with some images in it, the tablled is called "images". The thumb row is called "thumbs" and the imagename row is called "imgname" Now, if i want to have the images on my page displayed with the thumb, and a link to the original if you press it on in a nice 5 images per row line, how can i do this? i hope someone can help me do this.
I'm not quite sure what you mean by 'The thumb row is called "thumbs" and the imagename row is called "imgname"'... Eitherway, I assume you have a unique id of some sort for these db rows? You'll need to create a php script which does the job of displaying an image. So in your page displaying the thumbnails you'll have something like this: <img src="image.php?id=123"/> HTML: The id will be the id of the image in the db, use this within 'image.php' to load the image data from the db and output to screen. You'll also likely need to send image headers before outputting the contents of the image, something like this: header('Content-Type: image/jpeg'); PHP:
I think he's looking for the sql statement and a while loop for the results, to echo out five thumb images per row The thumb should link to the original. He'll probable need some kind of pagination system as-well, so its nothing much
what i wanted to do is to loop the thumb like this without the "back" as seen in the image, just the line of images. http://www.daniweb.com/web-development/php/threads/attachment.php?attachmentid=16585&d=1281523525
if i understand it right, thumbs is the file name of the thumbnail while imgname is the file name of the orginal file? if yes, you can try this: mysql_connect('localhost','user','password'); mysql_select_db('the_database'); $result = mysql_query("SELECT * FROM images"); $ctr = 0; while($row = mysql_fetch_assoc($result)) { echo '<a href="/the/path/to/the/original/files/directory/'.$row['imgname'].'"><img src="/the/path/to/the/thumbnails/directory/'.$row['thumbs'].'" /></a>'; $ctr++; if($ctr >= 5) { echo '<br/>'; $ctr = 0; } } PHP: