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

Re: [PHP] multidimensional array sort

2005-03-14 Thread Ashley M. Kirchner
Leif Gregory wrote: http://us3.php.net/manual/en/function.array-multisort.php I did go through that, but I can't get it to work and I'm almost willing to bet it's because of the way the array is built. For example, the example on that page says that I should be able to do a sort on $ar[0] an

Re: [PHP] multidimensional array sort

2005-03-14 Thread Leif Gregory
Hello Ashley, Monday, March 14, 2005, 12:12:19 PM, you wrote: A> I need to do a sort on the whole thing in such a way that: A>a) all the Dir#'s are in ascending order, and A>b) all the User#'s are in ascending order with each Dir#, and A>b) all the File#'s are also in a

[PHP] multidimensional array sort

2005-03-14 Thread Ashley M. Kirchner
I have a multidimensional array that's built as follows (it's pretty much a directory tree): Array ( [Dir1] => Array ( [User1] => Array ( [0] => File1 [1] => File2 ) [User2] => Array { [0] => File1 [1] => File2 [2] => File3 } )

[PHP] Multidimensional Array advice from a newbie

2004-06-12 Thread grahama
Hi :) I am creating an XML file out of a mysql query with nested arrays. Currently I can get 1 element and 1 child with a properly formatted XML file with the below script . My question is: How do I add 3 to 4 more child elements to the below 'playlist' array ? Currently ,I have one parent 'Ar

Re: [PHP] Multidimensional Array manipluation...

2003-01-02 Thread Dhaval Desai
haval Desai <[EMAIL PROTECTED]> CC: [EMAIL PROTECTED] Subject: Re: [PHP] Multidimensional Array manipluation... Date: Thu, 2 Jan 2003 09:30:43 -0800 (PST) > >$test["0"]["hey"] = 1; > >$test["1"]["hi"] = 2; > >$test["2"]

Re: [PHP] Multidimensional Array manipluation...

2003-01-02 Thread Chris Shiflett
> >$test["0"]["hey"] = 1; > >$test["1"]["hi"] = 2; > >$test["2"]["hello"] = 3; > > I want to update $test["0"]["hey"] and set it as 1+1; If you just want to increment the value: $test["0"]["hey"]++; > Also is there any idea on how can we count() the values > in a multi dimensional arrays... Th

Re: [PHP] Multidimensional Array manipluation...

2003-01-02 Thread Dhaval Desai
rrays... Thanx From: Chris Shiflett <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: Dhaval Desai <[EMAIL PROTECTED]>, [EMAIL PROTECTED] Subject: Re: [PHP] Multidimensional Array manipluation... Date: Thu, 2 Jan 2003 09:04:27 -0800 (PST) --- Dhaval Desai <[EMAIL PROTECTED]>

Re: [PHP] Multidimensional Array manipluation...

2003-01-02 Thread Chris Shiflett
--- Dhaval Desai <[EMAIL PROTECTED]> wrote: > $test[0] = "hey"; > $test[1] = "hi"; > $test[2] = "hello"; > > Now I want to hold various values in $test[0]["hey"] = > "1" and $test[1]["hi"] = "2" and $test[2]["hello"] = "3" Try this instead: $test["0"]["hey"] = 1; $test["1"]["hi"] = 2; $test["2"]

[PHP] Multidimensional Array manipluation...

2003-01-02 Thread Dhaval Desai
Hello ppl, I was trying to do something with an array...I guess you could see what I mean from the code below: $test[0] = "hey"; $test[1] = "hi"; $test[2] = "hello"; Now I want to hold various values in $test[0]["hey"] = "1" and $test[1]["hi"] = "2" and $test[2]["hello"] = "3" and then I want

[PHP] Multidimensional array

2002-11-28 Thread Mako Shark
(Thanks to all who've replied about the streaming audio. Haven't had a chance to respond or anything yet.) Here is a problem I'm having similar to somethnig someone just posted, but not quite the same. I'm not too experienced with the intricacies and complications of arrays, but I have a bunch

Re: [PHP] multidimensional array

2002-04-19 Thread Miguel Cruz
On Fri, 19 Apr 2002, Rodrigo Peres wrote: > In order to avoid many left joins I took an aproach that I didn't know > if it's good, but I couldn't figure out another way. If my cliente has > 10 phone numbers I buld an array, serialize it and store in database, so > I didn't have to create another t

[PHP] multidimensional array

2002-04-19 Thread Rodrigo Peres
Hi list, In order to avoid many left joins I took an aproach that I didn't know if it's good, but I couldn't figure out another way. If my cliente has 10 phone numbers I buld an array, serialize it and store in database, so I didn't have to create another table. The problem is now I need to migra

[PHP] multidimensional array

2002-04-19 Thread Rodrigo Peres
Hi list, In order to avoid many left joins I took an aproach that I didn't know if it's good, but I couldn't figure out another way. If my cliente has 10 phone numbers I buld an array, serialize it and store in database, so I didn't have to create another table. The problem is now I need to m

RE: [PHP] Multidimensional array construction

2001-12-07 Thread Tim Ward
L PROTECTED]] Sent: 04 December 2001 15:22 To: PHP List; 'Mike Eheler' Subject: RE: [PHP] Multidimensional array construction Good day, Thanks to all who replied. This isn't quite what I needed, though. I _have_ the array (or delim

RE: [PHP] Multidimensional array construction

2001-12-04 Thread Darren Gamble
= Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Mike Eheler [mailto:[EMAIL PROTECTED]] Sent: Monday, December 03, 2001 5:30 PM To: Martin Towell Cc: 'Darren Gamble'; P

Re: [PHP] Multidimensional array construction

2001-12-03 Thread Mike Eheler
$$var = $some_value1; >echo $myarray["foo"]["bar"]["red"]["apple"]; >but when I tried it, it didn't work :( >looks like eval() to the rescue... > >-Original Message- >From: Darren Gamble [mailto:[EMAIL PROTECTED]] >Sent: Tu

RE: [PHP] Multidimensional array construction

2001-12-03 Thread Jim
> >print $SOMEVAL_1; >print $SOMEVAL_2; >print $SOMEVAL_3; >print $SOMEVAL_4; >print $SOMEVAL_5; > >print ""; > >... will produce: > >a >b >c >d >[Array] > >Which is cool. Not quite what you wanted, but maybe you could run with it. >

RE: [PHP] Multidimensional array construction

2001-12-03 Thread Jim
... will produce: a b c d [Array] Which is cool. Not quite what you wanted, but maybe you could run with it. Jim > >-Original Message----- >From: Darren Gamble [mailto:[EMAIL PROTECTED]] >Sent: Tuesday, December 04, 2001 10:37 AM >To: PHP List >Subject: [PHP] Multidimen

RE: [PHP] Multidimensional array construction

2001-12-03 Thread Martin Towell
foo"]["bar"]["red"]["apple"]; but when I tried it, it didn't work :( looks like eval() to the rescue... -Original Message- From: Darren Gamble [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 04, 2001 10:37 AM To: PHP List Subject: [PHP] Multidimens

[PHP] Multidimensional array construction

2001-12-03 Thread Darren Gamble
Here's a question for the list: I have a two-dimensional array; essentially a list of arrays. Each element (an array) can have any number of elements. As a small example: ( ( "foo" , "bar" , "red" , "apple" ), ( "foo" , "bar" , "red" , "car"), ( "foo" , "green" ) ) I would like to trave

[PHP] Multidimensional Array...

2001-10-18 Thread Roy van Pelt
Hello there... The problem is that I can only add one value into the array... Anyone knows what I'm doing wrong here(First project by the way!!) = '', 'pname' => '', 'pqty' => '')); $nrItems = 0; } // Get variables from products.php $pro

[PHP] multidimensional array from html forms

2001-10-05 Thread Larry Linthicum
Hi I just a PHP "hobbiest" trying to build a points calculating system for another hobby, please bear with me. I need to build a multidimensional array from a html form the array would look like: $needed_data = array ( array (id = $member_id, points = $position ),