Re: Multiple Image Display Problem

From: Date: Fri, 21 Dec 2001 07:26:06 +0000
Subject: Re: Multiple Image Display Problem
Groups: php.db 
Request: Send a blank email to php-db+get-15174@lists.php.net to get a copy of this message
Hi, your code seems fine except for the $result_array["speaker_id"] variable used when calling the image files. Shouldn't this be $result_array3["speaker_id"] and $result_array4["speaker_id"] respectively? Did you try to call the second image separately to see what is coming out of the database? Hope this helps Dobromir Velev Web Developer http://www.websitepulse.com -----Original Message----- From: Christopher Martin <cmartin@dbinteractive.com> To: php-db@lists.php.net <php-db@lists.php.net> Date: Thursday, December 20, 2001 19:08 Subject: [PHP-DB] Multiple Image Display Problem >I am having problems displaying two different images on the same page. >(stored as binary files in two different db tables) > >Instead of getting two different images, I am getting the first image twice, >although the scripts are going to two different database tables to get the >two images. > >Is there a way to get both images to display on this page? > >Any help would be much appreciated. Thank you. > >The main code is: ><? >if (count($result3) > 0) { >while ($result_array3 = mysql_fetch_array($result3, MYSQL_ASSOC)) { >if ($result_array3["speaker_id"] !== "") { >echo "<p><IMG SRC=\"small_image.php?speaker_id=" . >$result_array["speaker_id"] . "\"></p>"; >} >} >} >if (count($result4) > 0) { >while ($result_array4 = mysql_fetch_array($result4, MYSQL_ASSOC)) { >if ($result_array4["speaker_id"] !== "") { >echo "<p><IMG SRC=\"large_image.php?speaker_id=" . >$result_array["speaker_id"] . "\"></p>"; >} >} >} >?> >----------------- >small_image.php: > ><? >include("include.inc"); >$sql = "SELECT bin_data, filetype, filename, filesize FROM smphoto_bin_data >WHERE speaker_id=$speaker_id"; >// . $HTTP_SESSION_VARS["speaker_id"]; > >$result = @mysql_query($sql); >$data = @mysql_result($result, 0, "bin_data"); >$name = @mysql_result($result, 0, "filename"); >$size = @mysql_result($result, 0, "filesize"); >$type = @mysql_result($result, 0, "filetype"); > >header("Content-type: $type"); >header("Content-length: $size"); >header("Content-Disposition: attachment; filename=$name"); >header("Content-Description: PHP Generated Data"); >echo $data; >?> >---------------- >large_image.php: > ><? >include("include.inc"); >$sql = "SELECT bin_data, filetype, filename, filesize FROM lgphoto_bin_data >WHERE speaker_id=$speaker_id"; > >$result = @mysql_query($sql); >$data = @mysql_result($result, 0, "bin_data"); >$name = @mysql_result($result, 0, "filename"); >$size = @mysql_result($result, 0, "filesize"); >$type = @mysql_result($result, 0, "filetype"); > >header("Content-type: $type"); >header("Content-length: $size"); >header("Content-Disposition: attachment; filename=$name"); >header("Content-Description: PHP Generated Data"); >echo $data; >?> > > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net >For additional commands, e-mail: php-db-help@lists.php.net >To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.db (#15174) next »