Sashi,
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).
<html>
<head>
<title>Sashi's Test Page</title>
</head>
<body>
<?php
$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";
mysql_real_escape_string($value);
//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
mysql_free_result($output);
?>
</body>
</html>
Please note, I haven't tried this. It just seems plausible.
Good luck.
A-
-----Original Message-----
From: Sashikanth Gurram [mailto:[email protected]]
Sent: Sunday, March 01, 2009 10:27 PM
To: [email protected]
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.
Thanks,
Sashi
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sashikanth Gurram
Graduate Research Assistant
Department of Civil and Environmental Engineering
Virginia Tech
Blacksburg, VA 24060, USA
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php