Re: Re: Group By problem

From: Date: Mon, 13 Aug 2001 15:50:56 +0000
Subject: Re: Re: Group By problem
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-11299@lists.php.net to get a copy of this message
Thanks for your reply > > You don't show your SQL, but I assume it's something like > SELECT grp,svc,mach FROM table ORDER BY grp,svc,mach > Thats right. But its displaying the same as my code: --- Group:Desktop Service:BACKUP AITSBKUP Service:E-Mail AITSMAIL Service:E-Mail JEEVES Group:Unix Service:Database APOLLO Service:FIREWALL Console ----- I want it like this. Sorry if my previous email wasnt clear enough. Group:Desktop Service:BACKUP AITSBKUP Service:E-Mail AITSMAIL JEEVES Group:Unix Service:Database APOLLO Service:FIREWALL Console > then > $grp=""; > $svc=""; > $firstmach = true; > while ($row=mysql_fetch_array($result)) { > if ($grp != $row["grp"]) { > $grp = $row["grp"]; > PrintNewGroup($grp); > $svc = ""; // force new-svc when switching groups > } > > if($svc != $row["svc"]) { > $svc = $row["svc"]; > PrintNewService($svc); > $firstmach = true; > } > > PrintMach($row["mach"], $firstmach); > $firstmach = false; > } > > Hope this helps... > > > > -- > 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 (#11299) next »