> Question:
>
> Are the following two statements really equivalent?
>
> 1) echo "select binary_junk, filetype from images where img_id = '92'"
>
> 2) $get_image = "select binary_junk, filetype from images where img_id =
> '$imgid'";
I would have thought them equivalent since img_id is passed into the script from
the url (e.g. show_image.php?img_id=92). I think this right here is my
problem. For some reason php is no longer accepting those values. Guess I'll
have to go through the php.ini file and find out why it no longer does. PHP
4.1.2 did accept the passing of parameters.
> In particular, you might try doing an echo "$get_image" and see what shows up.
I could try that. The echo was me at a command prompt of the linux machine just
sending input into the mysql command-line program and sending the output to
another file to at least see that it is finding the record.
> In regular scripts, '$imgid' != '92'. I've had problems with MySQL queries
> occassionally behaving similarly. You could try changing those single-quotes
> to escaped double-quotes:
>
> $get_image = "select binary_junk, filetype from images where img_id =
> \"$imgid\"";
>
> -David
>
> > Date: Wed, 15 May 2002 19:32:44 -0700
> > From: "Kevin Brown"
> > To: plug-discuss@lists.plug.phoenix.az.us
> > Subject: Re: Upgraded to php 4.2.1, broke a script
> > Reply-To: plug-discuss@lists.plug.phoenix.az.us
> >
> > > > 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:
> > > >
> > > >
> > > >
> > > > 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.
> >
>
> ________________________________________________
> See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail doesn't post to the list quickly and you use Netscape to write mail.
>
> PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss