That worked. Thanks.

----- Original Message ----- From: "Chris" <[EMAIL PROTECTED]>
To: "Rob W." <[EMAIL PROTECTED]>
Cc: <php-general@lists.php.net>
Sent: Sunday, June 04, 2006 10:59 PM
Subject: Re: [PHP] Displaying data a certian way.


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/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to