Forums
This topic is locked
Getting binary data from MySQL using PHP4..
Posted 01 Apr 2003 12:00:43
1
has voted
01 Apr 2003 12:00:43 Oli Wilkinson posted:
Hello all,I use a script to display my images on a page. This has worked fine up to my recent upgrade to PHP 4.3.1 from 4.0.6.
Now all I get is an empty placeholder for my image.
In my page have use the following link to retreive my image:
<img src="getdata.php?id=<?php echo $HTTP_GET_VARS['id']?>
The id does come up so Ithink my problem is with the following getdata.php script:
<?php
if($id) {
@MYSQL_CONNECT("localhost","user","password"
@mysql_select_db("test"
$query = "select picture from news where id=$id";
$result = @MYSQL_QUERY($query);
$data = @MYSQL_RESULT($result,0,"picture"
Header( "Content-type: $type"
echo $data;
};
?>
The only thing that has changed is my upgrade to PHP 4.3.1...
I know I need to change the line:
if($id)
to something like:
if (isset($id))
to stop getting undefined variable errors. But I still dont get my images!
Any help would be greatly appreciated!
Cheers <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Replies
Replied 01 Apr 2003 12:13:10
01 Apr 2003 12:13:10 Oli Wilkinson replied:
Sorted it out!
I kept my orignal getdata.php with:
if($id) {
but added this to the top of my page:
<?
error_reporting(E_ALL - E_NOTICE);
?>
and all works as it should! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
I kept my orignal getdata.php with:
if($id) {
but added this to the top of my page:
<?
error_reporting(E_ALL - E_NOTICE);
?>
and all works as it should! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>