Re: Displaying data a certian way.

From: Date: Mon, 05 Jun 2006 03:59:08 +0000
Subject: Re: Displaying data a certian way.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-237391@lists.php.net to get a copy of this message
Rob W. wrote:
Ok, here's my issue that I have. Inside my database I have something that look's like this
id    serverid        cabinetid    ect...
-----------------------------------------------------------------
1     server1            1
2     server2            1
3     server3            1
I am trying to get it to display the servers 1 2 & 3 under a display bar of cabinet 1. Anybody have any solutions to this? I am a novis to php and mysql but i know the majority of the basics.
Remember the previous cabinet and you can use that for checking whether to display another heading: .... $previous_cabinet = ''; while($row = mysql_fetch_assoc($query_result)) { if ($row['cabinetid'] != $previous_cabinet) {
    echo "Cabinet id " . (int)$row['cabinetid'];
    $previous_cabinet = $row['cabinetid'];
} echo "Server " . htmlentities($row['serverid']) . "<br/>"; } -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#237391) next »