Upgraded to php 4.2.1, broke a script

Kevin Brown plug-discuss@lists.plug.phoenix.az.us
Wed, 15 May 2002 17:37:37 -0700


Tried posting this to the php list last week, but it went down and hasn't come
back since.

Just upgraded the php on my poor little DEC Alpha multia that is running on the
internal network here and it broke one of my php pages that pulls an image from
a db and displays it (yes I know, poor performance).  The script was working as
is with 4.1.2.

show_image.php:

<?
include("movie_conf.php");
dbConnect();

$get_image = "select binary_junk, filetype from images where img_id = '$imgid'";
$get_image_result = mysql_query($get_image);

$binary_junk = mysql_result($get_image_result,0,"binary_junk");
$filetype = mysql_result($get_image_result,0,"filetype");

header("Content-type: $filetype");
echo "$binary_junk";
?>

Sample call: http://10.0.0.120/movies/show_image.php?imgid=92

output from it is:

Warning: Unable to jump to row 0 on MySQL result index 2 in
/home/httpd/html/movies/show_image.php on line 8

Warning: Unable to jump to row 0 on MySQL result index 2 in
/home/httpd/html/movies/show_image.php on line 9

Warning: Cannot add header information - headers already sent by (output started
at /home/httpd/html/movies/show_image.php:8) in
/home/httpd/html/movies/show_image.php on line 11

I can remove the last error by commenting out the header(" "); call, but that
should be needed so the browser knows it is receiving a jpeg or gif image.  I
have other scripts that connect to the same database by calling the dbConnect();
function and they are able to pull information from the mysql db.  I also
checked the tables that hold the images and they are still in working order.