Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    May 2011
    Posts
    43
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Need Help::Latest uploaded images from different folders

    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???

    PHP Code:
    $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_title020);
        
        ***
    $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.

  • #2
    New Coder
    Join Date
    May 2011
    Posts
    43
    Thanks
    6
    Thanked 0 Times in 0 Posts
    sorry, I meant to post this in php, must have clicked mysql by accident


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •