PHP - MySQL Help
Hey i have a script that i made to get data from a database and then an image.. now i have the getting the data from the database part done but for the life of me i cant figer out how to get this image part dont
now let me show you the PHP script..
<?php
$hostname = \"localhost\";
$user = \"********\";
$password = \"********\";
$db = \"********\";
$image = \"select imagedata from imagedata where id = $image\";
$count = 0;
mysql_connect($hostname, $user, $password);
mysql_select_db($db);
$result = mysql_query($image);
while(list($imagedata) = mysql_fetch_row($result))
{
print(\"$imagedata\");
exit;
}
?>
Now lets say i have this script in the location
http://www.domainanme/imagedata.php?image=1
now i have passed it a veriable which is 1
now i got it all working by getting the data out with using an ID and stuff now i want to get the image the way iwant to get the image is by taking that 1 from the veriable and putting that in the img src="$variablenumber.jpg" do you get what i mean?? anywho how would i do that?
Mark Hensler posted this at 04:20 — 4th September 2001.
He has: 4,048 posts
Joined: Aug 2000
the image will look like this:
I'm probably not understanding the question. Sorry.
Zacrifice posted this at 05:12 — 4th September 2001.
They have: 13 posts
Joined: Aug 2001
na thats not it.. you can see how its ment to work
http://rick.zacrifice.com/test/urltest.php?image=1 (oops that was spelt wrong)
you should get some gibberish and a broken image
now if you right click that image and have a look at the propertys you will see the name of the image is the same as the text on the page..
What i want is for that image to be called 1 like the image=1 part and when someone called image=2 i want the image to be called 2
like
i.jpg
2.jpg and so on
Mark Hensler posted this at 06:15 — 4th September 2001.
He has: 4,048 posts
Joined: Aug 2000
You can't do that.
The page that prints the tag cannot print the image data. So, your Image src property must point to the PHP page that will print the image data. The src must be "imagedata.php?image=1", and you cannot reprint the image src property to say "1.jpg".
Did I understand correctly this tim?
Mark Hensler
If there is no answer on Google, then there is no question.
Zacrifice posted this at 14:21 — 4th September 2001.
They have: 13 posts
Joined: Aug 2001
its kewl mate i got it fixed.. it works howi want it too
all i did was add an ID tag in the right places (i used ID becouse i used ID in the database so find the right text) get what i mean?
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.