Forum Moderators: coopster
$sql = "SELECT Pic FROM Pictures WHERE ID=$id";
if(!($result=@mysql_query($sql))) showerror;
$data=@mysql_fetch_array($result);
if (!empty($data['Pic']))
{
//Change content type to your file type
header("Content-Type: image/gif");
print $data['Pic'] ;
}
i recommend that when placing the data into the database you actually take the datatype then, therefore you can output the info on the fly without having to manually set the content type each time.
Put the absolute path of the image in a field and then use php to grab it.
If you build many web sites like I do, you will best have the image stored on one server and use one Mysql database to grab images and text etc.
I recently built a 500 page web site by importing all the data into a mysql. Works great and with virtually no errors, no broken links :)