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 7078927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:36:29+00:00 2026-05-28T06:36:29+00:00

I have a list with images which I display from db like this: <?php

  • 0

I have a list with images which I display from db like this:

<?php                                           
    $result = mysql_query("SELECT * FROM images ORDER BY position");
    while ($image = mysql_fetch_array($result)){
?>
        <img src="/<?php echo $image['thumb'];?>" />
    
php } ?>

I already created a mask where to display the big image but I have no idea how do I know which image is clicked then to display the big image inside the popup.

Fields I use from db are

image_id    
image   
position    
thumb
  • 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-28T06:36:29+00:00Added an answer on May 28, 2026 at 6:36 am

    You need to surround your <img> tag with a <a> link that points to another PHP script which retrieves the correct image:

    Inside your while() loop:

    <a href='getImage.php?id=<?php echo $image['image_id']; ?>'>
      <img src="/<?php echo $image['thumb'];?>" />
    </a>
    

    getImage.php

    getImage.php mainly displays an <img> tag containing the full size image selected earlier. Be sure to fill in the rest of the HTML it needs as necessary, as I have only included the <img> tag below.

    $img = isset($_GET['id']) ? intval($_GET['id']) : NULL;
    
    if ($img) { 
      $image_qry = mysql_query("SELECT image FROM images WHERE image_id = $img");
      if ($image_qry) {
        $image_data = mysql_fetch_assoc($image_qry);
        // One row was returned...
        if ($image_data) {
          echo "<img src='{$image_data['image']}' alt='alt text...' />";
        }
      }
    }
    else {
      // Invalid id, not an integer
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of images which I want to display in a page.
I have a CSS like this ul { list-style-image:url(images/bulletArrow.gif); } ul li { background:
I have the following jQuery which I want to output a list of images.
I have a List<> of items which I want to display in a 3
I have a list of images that are pulled from a database and loaded
I have a script which will list all the files from the image folder
I have a jQuery dialog which I fire from a list of items in
I have a very simple ASP.NET MVC site which displays images from the database.
I have two problems with ListView+images. I get the values for the list from
i have list of images and on mouse over there is option box shows

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.