...

View Full Version : Need Help::Latest uploaded images from different folders



twinrecords
08-08-2011, 11:15 AM
I need to display the 5 latest uploaded images in a sidebar on my site, using php 5 and mysql, I am able to fetch the image title and other info that was written to the DB on upload, however, the photos are uploaded into different folders because they are different categories, so how exactly do I fetch the images for display???



$sql = mysql_query("SELECT * FROM images ORDER BY image_time DESC LIMIT 3");

while($row = mysql_fetch_array($sql)){

$image_id = $row["image_id"];
$image_title = $row["image_title"];
$folder = $row["folder"];
$image_title = substr($image_title, 0, 20);

***$check_pic = "????";***
if (file_exists($check_pic)) {
$latest_pic = "<img class=\"shadow\" src=\"$check_pic\" width=\"75px\" border=\"0\" />";
}

$LatestPicDisplay .= '<td align="center"><div align="center" style=" font-size: 12px; height:94px; width: 99px; overflow:hidden;" ><a href="path_to_file' . $latest_pic . '' . $image_title . '<br></div></td>';

}

?>


and of course I make the 'print' call for the LatestPicDisplay later in the html.

I'm still pretty new to php, the line in the asterisks is what I used on my other site, but that was for showing latest members who only had one photo.

so as I said, I don't know how to grab the latest photos from the different folders, for example, one photo called FERRARI was uploaded to the folder CARS, then the next photo named DUCATI was uploaded to the folder BIKES and so on, it will show Ferrari, CARS and Ducati, BIKES in the side bar but no image.

twinrecords
08-08-2011, 12:00 PM
sorry, I meant to post this in php, must have clicked mysql by accident



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum