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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:45:58+00:00 2026-06-17T09:45:58+00:00

Hello There Fellow Devs! I’m trying to retrieve an image from my database to

  • 0

Hello There Fellow Devs! I’m trying to retrieve an image from my database to include it with this table I created. All the Examples I looked up on Google are for retrieving images from 1 table alone that contains only images, but in this case I can’t get it working.

<?php
                    $Con = mysql_connect('localhost','root','');
                      if($Con === false)
                      {
                        echo "Not Connected";
                      }

                      else
                      {


                        $select = mysql_select_db("symfony");
                        $TableName = "main";
                        $SQLstring = "SELECT * FROM $TableName ";
                        $QueryResult = mysql_query($SQLstring);
                        $Row = mysql_fetch_row($QueryResult);
                            do {


                                echo "<div class='art-content-layout'>";
                                echo "<div class='art-content-layout-row'>";
                                echo "<div class='art-layout-cell' style='width: 33%'>";
                                echo"   <p><img width='259' height='194' class='art-lightbox' name='image' src='../images/3.jpg'><br></p>";
                                echo "</div>";
                                echo "<div class='art-layout-cell' style='width: 67%'>";
                                echo "<p></p>";
                                echo "<table border>";
                                echo "<tbody>";
                                echo "<tr>";
                                echo "<tr>";
                                    echo "<th colspan='3' align='left'><b> Owner : $Row[0]</b></th>";
                                echo "</tr>";
                                echo "<tr>";
                                    echo "<td colspan='3'><b>$Row[1]:</b>";

                                   echo  "</td>";
                                echo "</tr>";

                                echo "<tr>";
                                    echo "<td><b>Price:$Row[9] US Dollar </b></td>";
                                echo "</tr>";
                                echo "<tr>";
                                    echo "<td><b> City: $Row[4] </br> Hood: $Row[4] </br> Qdr: $Row[5] </br> Street:$Row[6] </br> Property Number :$Row[7] </br> Room Number : $Row[8] </b></td>";
                                    echo" <td><b>Description : $Row[10] </b></td>";

                                echo "</tr>";
                                echo"<tr>";
                                    echo" <td><b>Type : $Row[12] </b></td>";
                                    echo "<td><b>Contact : $Row[1] </b></td>";
                                echo "</tr>";
                                echo "</tr>";
                                echo "</tbody>";
                                echo "</table> <br><p></p>";

                                echo "</div>";
                                echo "</div>";
                                echo "</div>";
                                $Row = mysql_fetch_row($QueryResult);
                                } while ($Row);     
                        }   
                ?> 

I tried to do this, it still didn’t work :

$img = $Row[15];
//column 15 is the Blob the image
                        $img = mysql_fetch_array($QueryResult);
                            $content = $img['15'];
                            //header('Content-type: image/jpg');
  • 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-06-17T09:45:59+00:00Added an answer on June 17, 2026 at 9:45 am

    You can’t do what you are trying to do. You need to separate your logic into two scripts. There really isn’t a way to get the image data in the same pass as your other data because the IMG tag is fed a SRC that is not raw data, but instead asks the server to serve the image.

    In your current script where you generate the HTML you just need to have your IMG tag reference the SRC as a new script that does the work of retrieving your image data. Something like:

    echo"   <p><img width='259' height='194' class='art-lightbox' name='image' src='display_image.php?id=" . $Row[0] . "'><br></p>";
    

    I’m assuming there that $Row[0] holds the unique key for the current record. Then you write another script, display_image.php that fetches just the image data and uses the proper headers to display it:

    $currentId = $_REQUEST['id'];
    //  Your query code would be here using the $currentId to just retrieve the desired record
    $SQLstring = "SELECT your_image_column_name FROM $TableName WHERE id = $currentId";
    $QueryResult = mysql_query($SQLstring);
    $img = mysql_fetch_array($QueryResult);
    $content = $img['your_image_column_name'];
    header('Content-type: image/jpg');
    echo $content;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to include Core Location and I'm trying to follow this tutorial: http://www.mobileorchard.com/hello-there-a-corelocation-tutorial/
Hello Again my fellow programmers out there, I'm designing and programming from scratch a
Hello fellow earthlings, I have an image as my background that I created in
Hello I´m trying to automate AZURE VM management like Amazon EC2. Is there any
Hello my fellow stackoverflower, i'm looking for away to smooth an image of and
hello is there a way to import data from excel 2007 file? it is
Hello there fellow Stackers! I wonder if anybody could tell me what the following
Hello fellow programmers, as you might know from my previous questions I'm an absolute
Oh hello there, fellow SO members, I have a web service that returns XML
Hello fellow Computer People! I could do this myself, but was just wondering if

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.