Re: Displaying data a certian way.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



That worked. Thanks.


----- Original Message ----- From: "Chris" <dmagick@xxxxxxxxx>
To: "Rob W." <rob@xxxxxxxxxxxxxxx>
Cc: <php-general@xxxxxxxxxxxxx>
Sent: Sunday, June 04, 2006 10:59 PM
Subject: Re:  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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux