Re: [PHP] multidimensional array problems

2007-01-19 Thread Larry Garfield
It's actually quite simple. You simply add another layer of grouping. General case: $result = mysql_query("SELECT a, b, c, d FROM foo ORDER BY a, b, c"); while ($record = mysql_fetch_object($result)) { $roster[$record->a][$record->b][] = $record; } ksort($roster); foreach ($roster as $a =>

Re: [PHP] multidimensional array problems

2007-01-19 Thread nitrox .
Ive followed your example on grouping. Im still trying to understand all of the code but ive made great progess on this with your example. Now I have one last issue and this will be solved. Ill remind here what Im trying to achieve I have a table for leagues, lookup table and team roster. There

Re: [PHP] multidimensional array problems

2007-01-13 Thread Jim Lucas
Give this a go $memroster = "SELECT inf_league.game, inf_league.type, inf_member.user_name, inf_member.rank, " . "inf_member.country, inf_member.email " . "FROM inf_league " . "INNER JOIN inf_memberleague ON inf_league.gid = inf_memberleague.l_id " .

Re: [PHP] multidimensional array problems

2007-01-13 Thread Larry Garfield
kup table and member table. Do > you think it would be better possably to do seperate querys and then match > them in php? would that be possable the given the setup i have? > > >From: Larry Garfield <[EMAIL PROTECTED]> > >To: php-general@lists.php.net > >Subject:

Re: [PHP] multidimensional array problems

2007-01-13 Thread Larry Garfield
It's better to just leave the record as an array and read it that way. while ($row = mysql_fetch_assoc($result)) { print "{$row['game']} {$row['type']}\n"; } And so on. You're not actually dealing with a multi-dimensional array yet; $result is an object from which you are extracting data record

[PHP] multidimensional array problems

2007-01-13 Thread nitrox doe
hi all, im very new to php but i think i jumped on the toughest thing to learn. Im trying to create a team roster that will show game, game type and league and then show each member based on the game type. Ive worked out alot of code but just cant figure where im going wrong. so here is my code. A