Thanks Marco!

It's working now. Based on your suggestion, here is waht I came up with.
It's working now.

Randy


------------  SNIP ------------------------------------

<table width="375" cellpadding="0" cellspacing="0" border="0"> 
        <tr>
        <td colspan="2" height="10"><?php echo FILLER; ?></td>
        </tr>
        <tr height=20 bgcolor="<? echo $color2; ?>">
        <td><b class="bGray"><b>&nbsp;Training Wave: <? echo $prior_wave;
?></b></td>
        <td align="right">&nbsp;</td>
        </tr>
        <tr>
        <td colspan="2" height="10"><?php echo FILLER; ?></td>
        </tr>
        
        --------------  ADDED THIS HERE -------------------
        <tr>
        <td>&nbsp; <? echo $record->last_name . ", " . $record->first_name;
?></td>
        </tr>
        ---------------  END ADDED CODE ----------------
         </table>  
                                
        <?
        }
        else
        {
        ?>
                                
        <table width="575" cellpadding="0" cellspacing="0" border="0">
        <tr>
            <td>&nbsp; <? echo $record->last_name . ", " .
$record->first_name; ?></td>
        </tr>
        </table>
------------------  END SNIP --------------------------------

>  -----Original Message-----
> From:         Marco Tabini <[EMAIL PROTECTED]>  
> Sent: Monday, October 14, 2002 7:17 AM
> To:   Rankin, Randy
> Cc:   [EMAIL PROTECTED]
> Subject:      Re: [PHP-DB] First record of array not being echoed
> 
> It seems to me that the first time you go through the loop, if
> $record->wave_num is != $prior_wave then you print the wave number but
> not the person's name--but you already have a record there with a
> person's name!
> 
> Try taking out the else statement--if you follow the code from there you
> should be able to fix it up.
> 
> Of course, I'm also doing this by just looking at your code, so I may be
> wrong (the odds are not in my favor) :-)
> 
> On Mon, 2002-10-14 at 07:58, Rankin, Randy wrote:
> > Good morning all.
> >
> > I am attempting to create a table in which there is a title cell
> populated
> > with a training wave number and then I would like to echo all members of
> > each training wave below the title cell (See example below for
> > clarification). All seems to be working with one exception. The first
> record
> > of each array is not being echoed. If I run the query in MySQL, all rows
> are
> > returned, so it must just be something I am not seeing in the code
> (which is
> > posted below). Thanks in advance for any help.
> >
> > Randy
> >
> > ----------------------  START EXAMPLE ---------------------------
> >
> >
> >     Training Wave: I-02
> >
> >     Brumley, Kennith
> >     Dillard, Lori
> >     Hamilton, Don
> >     Larsen, Gerry
> >     Robinson, Bobby
> >     Sarabi, Ray
> >     Shaddix, Kirby
> >     Springer, Leon
> >
> >     Training Wave: II-02
> >
> >     Boles, Scooby
> >     Deloney, Jerald
> >     Russell, Roger
> >     Smith, Martha
> >     Stockman, Joe
> >     Williams, Ed
> >
> >     ETC, ETC, ...
> >
> > ----------------------  END EXAMPLE ---------------------------
> >
> > --------------------  BEGIN CODE SNIPET
> ---------------------------------
> > <?
> > $sql = "SELECT u.last_name, u.first_name, w.wave_id, w.wave_num
> >     FROM USERS u, WAVES w
> >     WHERE w.wave_id = u.wave_id
> >     AND u.plant_id = '$plant_id'
> >     ORDER BY w.wave_id ASC, u.last_name ASC";
> >
> > $result = db_query ( $sql );
> >
> > for ( $i = 0; $i < db_num_rows ( $result ); $i++ )
> >             {
> >             $record = db_fetch_object ( $result );
> >
> >             if ( $record->wave_num != "$prior_wave" )
> >     {
> >             $prior_wave = $record->wave_num;
> >
> >             ?>
> >
> >                     <table width="375" cellpadding="0" cellspacing="0"
> > border="0">
> >                             <tr>
> >                                     <td colspan="2" height="10"><?php
> > echo FILLER; ?></td>
> >                             </tr>
> >                             <tr height=20 bgcolor="<? echo $color2; ?>">
> >                                     <td><b
> > class="bGray"><b>&nbsp;Training Wave: <? echo $prior_wave; ?></b></td>
> >                                     <td align="right">&nbsp;</td>
> >                             </tr>
> >                             <tr>
> >                                     <td colspan="2" height="10"><?php
> > echo FILLER; ?></td>
> >                              </tr>
> >                             </table>
> >
> >             <?
> >     }
> >     else
> >     {
> >             ?>
> >
> >                     <table width="575" cellpadding="0" cellspacing="0"
> > border="0">
> >                             <tr>
> >                                     <td>&nbsp; <? echo
> > $record->last_name . ", " . $record->first_name; ?></td>
> >                             </tr>
> >                     </table>
> > <?
> >     }
> >
> >    }
> > }
> > }
> > ?>
> >
> > -------------------------  END CODE SNIPET
> > -------------------------------------------------
> 
> 

Reply via email to