0

Yes, I know this is a common one, but I've inserted images in a database and can't for the life of me get them to display. And before anyone suggests I shouldn't do it, they are only small pictures and a maximum of four. I am currently using two pages to display the pictures. This is the main page:

<?
mysql_connect("localhost", "username", "password") or die(mysql_error());
mysql_select_db("debname") or die(mysql_error());
$result=mysql_query("SELECT * FROM newyddion") or die("Can't Perform Query");
While($row=mysql_fetch_object($result)) {
echo "<IMG SRC=\"picupload3.php3?id=$row->id\">";
}
?>

And this is the supporting page (i.e. picupload3.php3):

<?php
ini_set("register_globals",1);
mysql_connect("localhost", "username", "password") or die(mysql_error());
mysql_select_db("debname") or die(mysql_error());
$result=mysql_query("SELECT pic1 FROM newyddion WHERE id=$id") or die("Can't perform Query");
$row=mysql_fetch_object($result);
Header( "Content-type: image/jpg");
echo $row->pic1;
?>
2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by mwasif
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.