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 =>
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
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 " .
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:
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
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
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
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
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
}
)
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
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"]
> >$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
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]>
--- 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"]
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
(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
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
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
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
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
=
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
$$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
>
>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.
>
... 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
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
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
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
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 ),
28 matches
Mail list logo