> > 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
>
> First, make sure you got a result, then make sure there's data in it.
>
> $get_image_result = mysql_query($get_image);
> if( $get_image_result ) {
> $num_rows = mysql_num_rows( $get_image_result );
> if ( $num_rows > 0 ) {
> // got results
> // do stuff
> } else {
> // didn't get results
> // catch error
> }
> }
>
> Have you tried the query from msql ( I think that's the name, it's psql for
> the postgreSQL version )?
OK, tried it with the error checking if then statements. I'm not getting any
results back from the database, but if I run the exact same command via the
command line I get back a good result from the db.
echo "select binary_junk, filetype from images where img_id = '92'" | mysql -u
root movies > /tmp/mysqloutput
The image ID is a unique number. Only thing I can think is that something
changed regarding the mysql connection functions. Saw that 4.2.1 had a fix for
4.2.0 regarding connecting to a mysql db, so maybe there are other issues.
Still find it funny that only the page that gets images is broken when all the
other pages are displaying correctly.