This (likely) means you have a some generic page (i.e., picture.php)
that displays some picture. The picture it displays depends on the
parameter passed when the page is called (i.e., 123).

                <title>Sashi's Test Page</title>

                $value = $_GET ['qry'];
                //Get your parameter
                if (!$value) die("Uh oh, trying to call the page without
a valid qry value.");
                //Write a query to pull out the picture's path
                $sql = "SELECT path FROM Image WHERE ID = %s";
                //Execute the query
                $output = mysql_query($sql);
                //Display the corresponding picture
                while ($row = mysql_fetch_assoc($output)) {
                    printf("<img src=\"%s\" />", $row['firstname']);
                //Clean up


Please note, I haven't tried this. It just seems plausible.

Good luck.


-----Original Message-----
From: Sashikanth Gurram [] 
Sent: Sunday, March 01, 2009 10:27 PM
Subject: [PHP-DB] Retrieving Image Location in MySQL

Dear All,

I am trying to retrieve the location of a image (not the image, just the

location of the image) stored on MySQL database, using PHP to display it

in my browser. One of the users has been kind enough to provide me with 
an example code as to how to do it. He asked me to use /<img 
src="picture.php?&qry=123"> /in the html code. I understood the part of 
/picture.php? /which tells us that the php code used to retrieve the 
image is located in the file picture.php (If what I have understood is 
correct). But I did not quite understand the second part /&qry=123 /. 
What does this mean? Of what use is this second part? Does the variable 
&qry has something assigned to it in the picture.php code? I would 
greatly appreciate it if any one of you can answer my questions.


Sashikanth Gurram
Graduate Research Assistant
Department of Civil and Environmental Engineering
Virginia Tech
Blacksburg, VA 24060, USA

PHP Database Mailing List (
To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to