Thanks for the help guys...,

After some sleep and some food this is where it's gone;

$query = "select wn_pdate, wn_text, wn_id " . 
              "from whatsnew " .
              "order by wn_pdate";

$pdate = "";
while($row = mssql_fetch_array($result)){
    if ($pdate != $row[0]) {
        print "<tr><td>" . $row[0]</td></tr>";
        $pdate = $row[0];
    }

    print "<tr><td><a href=\"$id\">" . $row[1] . "</a></td></tr>";
}

Results;

Date 1
Item one
Item two
Item three

Date 2
Item four
Item five
Item six 

... etc

It produces the results that I was looking for and it's much less code.


alex hogan


> -----Original Message-----
> From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED]
> Sent: Thursday, February 19, 2004 4:50 AM
> To: 'Alex Hogan'; PHP General list
> Subject: RE: [PHP] Nested Loops
> 
> On 18 February 2004 22:13, Alex Hogan wrote:
> 
> > Sorry...,
> >
> >
> >
> > Line 17 is: print "<tr><td><a
> > href=\"$id\">$row2[$rtxt]</a></td></tr>";
> 
> I haven't a clue what this is relating to (bit *too* much snippage
> there!), but I think that statement is going to need some curly braces to
> have a chance of working as intended:
> 
>    print "<tr><td><a href=\"$id\">{$row2[$rtxt]}</a></td></tr>";
> 
> 
> Cheers!
> 
> Mike
> 
> ---------------------------------------------------------------------
> Mike Ford,  Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
> Email: [EMAIL PROTECTED]
> Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211


****************************************************************** 
The contents of this e-mail and any files transmitted with it are 
confidential and intended solely for the use of the individual or 
entity to whom it is addressed.  The views stated herein do not 
necessarily represent the view of the company.  If you are not the 
intended recipient of this e-mail you may not copy, forward, 
disclose, or otherwise use it or any part of it in any form 
whatsoever.  If you have received this e-mail in error please 
e-mail the sender. 
****************************************************************** 


Reply via email to