Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7696371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:45:51+00:00 2026-05-31T21:45:51+00:00

I am building an image uploading website. Images are uploaded to a directory on

  • 0

I am building an image uploading website. Images are uploaded to a directory on the server and data such as the filename is stored in a MySql table. I have created a ‘gallery’ page which displays all the uploaded images as thumbnails. When a user clicks on one of the images, it takes them to ‘image.php’ page, which will display the image full size and echo information such as the username of the person who uploaded the image etc.

I am unsure as to what would be the correct way of displaying the image. The images in my MySql table have unique ID’s which I’m guessing will have to be manipulated in some way, but how do I would I get the ID of the photo that has been clicked on into the ‘image.php’ MySql query?

Hope this has been explained well enough. Thanks in advance.

gallery.php page… (exclusing database connections etc.)

    //Retrieves data from MySQL 
 $data = mysql_query("SELECT * FROM photos");
 //Puts it into an array 
 while($info = mysql_fetch_array( $data )) 
 {
 ?> 

<section class="thumbnails group">

<a href="image.php?id=<?php $info['id'] ?>"> <?php Echo "<img src=http://.../thumbs/tn_".$info['filename'] .">"; }?> </a>

</section>

image.php page…

//Retrieves data from MySQL 
 $data = mysql_query("SELECT * FROM photos WHERE 'id' = ??");
 //Puts it into an array 
 while($info = mysql_fetch_array( $data )) 
 {
 ?> 

<section class="main-image group">

<?php echo "<img src=http://.../images/".$info['filename'] .">"; }?>

</section>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T21:45:52+00:00Added an answer on May 31, 2026 at 9:45 pm

    You can simply pass the ID of the image through in the querystring

    <a href="image.php?image=' . $imageID . '"><img src="/path/to/thumbnail"></a>
    

    In your image.php page, you can retrieve the ID like this (assuming it’s an integer):

    $imageID = intval( $_GET["image"]);
    

    You should then be able to retrieve the path to the image and display it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm building a simple school portal, i have stucked at uploading an image into
I'm building a website currently with a page for uploading images. The images will
I am building a website where I am uploading images to my ftp folder
I recently started building a bookmarklet that displays the EXIF data of any image
I'm building an image gallery. Under the images, I want to display links under
I'm building an app with an image upload function. While the uploading process is
I'm building an image gallery and have been able to get the clicked thumbnail
I'm building an image gallery which present a few images in the frontpage. The
I'm building an image uploading script (for the first time) in Codeigniter and the
i am building one module wherein user can post their data. i have few

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.