missing array element



Hi,

I was wondering if anyone could help me with a problem I am having with
an array. I am only a beginner, so please be gentle!

I am trying to store the id's for 3 hotel rooms into an array called
$rooms, using a simple mysql select statement. Here is the code:


<?php require_once('Connections/Vita_Italiano.php'); ?>
<?php mysql_select_db($database_Vita_Italiano, $Vita_Italiano);
$query_rsAllRooms = "SELECT * FROM room";

$rsAllRooms = mysql_query($query_rsAllRooms, $Vita_Italiano) or
die(mysql_error());

$row_rsAllRooms = mysql_fetch_assoc($rsAllRooms);
$totalRows_rsAllRooms = mysql_num_rows($rsAllRooms);

// create array of all rooms
while ($row_rsAllRooms = mysql_fetch_assoc($rsAllRooms))
{
$rooms[]= $row_rsAllRooms['Room_Number'];
}

?>

When I use <?php print_r($rooms);?> to display the contents of the
variable, the array only contains 2 room numbers, instead of 3. These
are stored in $rooms[0] and $rooms[1].

Does anyone have any ideas what is going on here?

Thanks in advance,

David Robinson

.



Relevant Pages

  • Re: argh! more undocumented mysteries: to_yaml
    ... You cannot use to_yaml for Array, ... Object#to_yaml in Ruby Documentation. ... Beginner woes, here, no doubt, but woes nevertheless. ...
    (comp.lang.ruby)
  • Re: date format
    ... I'm not a beginner and I found this example rather obscure and hard to ... Perl needn't look that much like line noise IMO. ... but the content of that array is not univocal here anyway) ...
    (comp.lang.perl.misc)
  • type mismatch
    ... I am a beginner in programming VBA ... I want to write a function that returns an array where each element is ... Ctrl-Shift-Enter ...
    (microsoft.public.excel.programming)
  • Re: Using pointers
    ... I am also a beginner, but will try and give my thoughts also. ... Dynamic memory is a good way to go when you don't know ahead of time how ... It's wastefull to dedicate an array of ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Using pointers
    ... > Dan Moos wrote: ... >> I am also a beginner, but will try and give my thoughts also. ... >> Dynamic memory is a good way to go when you don't know ahead of time how ... >> array or other structure that is big enough to hold the largest number ...
    (alt.comp.lang.learn.c-cpp)