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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:18:18+00:00 2026-05-12T18:18:18+00:00

The user on my site can currently search a mysql db via PHP, and

  • 0

The user on my site can currently search a mysql db via PHP, and the results are displayed on the same page inside a DIV, thanks to ajax…

What I need now is to display an image that is associated with the mysql results…
Say the result has ID=250, then I want a piece of code to search in a folder for an image with the name 250.jpg on the server…

And then display this image in a table column using php script…

Here is my php script that displays the results as well as where I want the picture to appear…

Please help me…

   $qry_result = mysql_query($query) or die(mysql_error());

}
// Build Result String
$display_table = "<table align='center'>";

// Insert a new row in the table for each result
while($row = mysql_fetch_array($qry_result)){
$display_table .= "<tr>";
$display_table .= "<td class='ad_container' colspan='4'></td>";
$display_table .= "</tr>";
$display_table .= "<tr>";
$display_table .= "<td width='110' rowspan='2'>----- IMAGE HERE -----</td>";
$display_table .= "<td width='377' height='15'>$row[headline]</td>";
$display_table .= "<td width='67' rowspan='2'>$row[insert_date]</td>";
$display_table .= "</tr>";
$display_table .= "<tr>";
$display_table .= "<td height='15'>$row[price]:-</td>";
$display_table .= "</tr>";
}

$display_table .= "</table>";
echo $display_table;
  • 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-12T18:18:19+00:00Added an answer on May 12, 2026 at 6:18 pm

    This solution checks to ensure the image actually exists prior to display:

    // absolute path to image directory
    $path = '/var/www/vhosts/path/to/dir';
    
    // basepath image directory
    $basepath = '/path/to/dir';
    
    // assuming you store JPEGs
    $image = $row['id'] . '.jpg';
    
    // start column output
    $display_table .= '<td width="110" rowspan="2">';
    
    // make sure image exists
    if (file_exists($path . $image)) {
       $display_table .= '<img src="' . $basepath . $image . '" />';
    }
    
    // end column output
    $display_table .= '</td>';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a site that can be displayed to the user in several
On my site, user profiles can be reached by the url www.example.com/user/profile.php?uid=3 I want
I have a page where a user can import data to the site. either
Active site can be seen here: http://www.studioimbrue.com/index2.php There are currently two small problems with
How can I detect the site the user came from before accessing mine in
I am developing a site where users can buy features using paypal. If user's
I have a credit system set up on my site where user A can
A user can upload a picture on my site at which point jQuery inserts
I want to build a site where the user can enter text and format
I want to make a site where there user can basically navigate the web

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.