On 4/3/06, Mace Eliason <[EMAIL PROTECTED]> wrote: > This is what I am doing and the output (for testing) seems correct > while($row=mysql_fetch_array($result)) > { > $banner= array($arrayIndex => $row); > > echo $banner[$arrayIndex]["image"]. "<br>"; > echo $banner[$arrayIndex]["url"]. "<br>"; > echo $banner[$arrayIndex]["display_type"]. "<br>"; > $arrayIndex++; > } >
Tom is correct, you're overwriting $banner each time. While the following is a bit verbose (Tom's assignment step is all you need), this might help to show what's happening: [code] $banner_array = array(); while ($row = mysql_fetch_array($result)) { $banner_array[] = array( "url" => $row["url"], "image" => $row["image"], "display_type" => $row["display_type"] ); } [/code] > $value=0; > while($value < $number_of_banners_db ) > { > echo $banner[$value]["url"]. "<br>"; > echo $banner[$value]["image"]. "<br>"; > echo $banner[$value]["display_type"]. "<br>"; > } Here you're also not incrementing your loop counter. Try this: [code] foreach($banner_array as $banner) { echo $banner["url"] . "<br>"; echo $banner["image"] . "<br>"; echo $banner["display_type"] . "<br>"; } [/code] HTH, John W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php