Loading Image from mysql database
Posted: Fri Dec 14, 2007 7:25 am
feyd | Please use
but I keep getting Cant Perform Query, obviously theres somthing wrong with the SQL, but I cant work out what? As it all seems correct. Even using diffrent php code (without sql errors) i've not been able to get the image to display, so if anyone has a quick way of doing this, I'd b very gratefull!!
image = field
species = table
index = index (being taken from... echo "<IMG SRC=\"getimage.php?PicNum=$row->PicNum\">"; on the main page)
I want to take the corrosponding blob out of mysql, depending on the index/picnum that is sent to the page, then show it as a jpeg image
I made this using an example page, i've tried several but not been able to get it working
(mysql5/php5)
Thanks from a nooooob!
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I've been trying to extract images from a database to display in a page using this...Code: Select all
<?php
mysql_connect('****','****','****') or die("Unable to connect to SQL server");
@mysql_select_db('fomicidae_species') or die("Unable to select database");
$result=mysql_query('SELECT image FROM species WHERE index=$PicNum') or die ("Can't perform Query");
$row=mysql_fetch_object($result);
Header("Content-type: image/jpeg");
echo $row->Image;
?>image = field
species = table
index = index (being taken from... echo "<IMG SRC=\"getimage.php?PicNum=$row->PicNum\">"; on the main page)
I want to take the corrosponding blob out of mysql, depending on the index/picnum that is sent to the page, then show it as a jpeg image
I made this using an example page, i've tried several but not been able to get it working
(mysql5/php5)
Thanks from a nooooob!
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]