Help rapresenting multidimensional array ( pivot table )

  • Follow


Hi all,

I have a multidimensional array
that rapresent  category/subcategory/susubcategory
( 3 levels )

This is an example:

Array
(
    [6201GC1XWI] => Array
        (
            [OP-09-000002] => Array
                (
                    [2] => 1
                    [7] => 1
                    [37] => 1
                )

            [OP-09-000667] => Array
                (
                    [3152] => 1
                )

            [OP-09-001426] => Array
                (
                    [7396] => 1
                )

        )

    [coptuGe239] => Array
        (
            [OP-09-000005] => Array
                (
                    [3] => 1
                    [8] => 1
                    [38] => 1
                )

            [OP-09-000089] => Array
                (
                    [108] => 1
                )

            [OP-09-000292] => Array
                (
                    [600] => 1
                )

            [OP-09-000380] => Array
                (
                    [961] => 1
                    [993] => 1
                    [1010] => 1
                    [1051] => 1
                    [1366] => 1
                    [1433] => 1
                    [1537] => 1
                    [1576] => 1
                )

        )

I extract the original data from an SQL table:


foreach ($rs->GetRows() as $k => $v)
{
$GRID[$v["product_code][$v["order_number"]][$v["step_number"]] =1;
}

Please, have you an idea to display it on a table
( like a "pivot" table ) ?

I can't manage the RowSpan ..
because i can have N product_code
N order_number
N step_number

Thanks!

-- Yena --
0
Reply carpacoi (1) 2/1/2010 7:36:32 AM

Yena wrote:
> Hi all,
> 
> I have a multidimensional array
> that rapresent  category/subcategory/susubcategory
> ( 3 levels )
> 
> This is an example:
> 
> Array
> (
>     [6201GC1XWI] => Array
>         (
>             [OP-09-000002] => Array
>                 (
>                     [2] => 1
>                     [7] => 1
>                     [37] => 1
>                 )
> 
>             [OP-09-000667] => Array
>                 (
>                     [3152] => 1
>                 )
> 
>             [OP-09-001426] => Array
>                 (
>                     [7396] => 1
>                 )
> 
>         )
> 
>     [coptuGe239] => Array
>         (
>             [OP-09-000005] => Array
>                 (
>                     [3] => 1
>                     [8] => 1
>                     [38] => 1
>                 )
> 
>             [OP-09-000089] => Array
>                 (
>                     [108] => 1
>                 )
> 
>             [OP-09-000292] => Array
>                 (
>                     [600] => 1
>                 )
> 
>             [OP-09-000380] => Array
>                 (
>                     [961] => 1
>                     [993] => 1
>                     [1010] => 1
>                     [1051] => 1
>                     [1366] => 1
>                     [1433] => 1
>                     [1537] => 1
>                     [1576] => 1
>                 )
> 
>         )
> 
> I extract the original data from an SQL table:
> 
> 
> foreach ($rs->GetRows() as $k => $v)
> {
> $GRID[$v["product_code][$v["order_number"]][$v["step_number"]] =1;
> }
> 
> Please, have you an idea to display it on a table
> ( like a "pivot" table ) ?
> 
> I can't manage the RowSpan ..
> because i can have N product_code
> N order_number
> N step_number
> 
> Thanks!
> 
> -- Yena --

You need to count() the number of items in your arrays to determine the 
appropriate value for your rowspan.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
0
Reply Jerry 2/1/2010 10:00:14 AM


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/02/10 08:36, Yena wrote:
> Hi all,
> 
> I have a multidimensional array
> that rapresent  category/subcategory/susubcategory
> ( 3 levels )
> 
> This is an example:
> 
> Array
> (
>     [6201GC1XWI] => Array
>         (
>             [OP-09-000002] => Array
>                 (
>                     [2] => 1
>                     [7] => 1
>                     [37] => 1
>                 )
> 
>             [OP-09-000667] => Array
>                 (
>                     [3152] => 1
>                 )
> 
>             [OP-09-001426] => Array
>                 (
>                     [7396] => 1
>                 )
> 
>         )
> 
>     [coptuGe239] => Array
>         (
>             [OP-09-000005] => Array
>                 (
>                     [3] => 1
>                     [8] => 1
>                     [38] => 1
>                 )
> 
>             [OP-09-000089] => Array
>                 (
>                     [108] => 1
>                 )
> 
>             [OP-09-000292] => Array
>                 (
>                     [600] => 1
>                 )
> 
>             [OP-09-000380] => Array
>                 (
>                     [961] => 1
>                     [993] => 1
>                     [1010] => 1
>                     [1051] => 1
>                     [1366] => 1
>                     [1433] => 1
>                     [1537] => 1
>                     [1576] => 1
>                 )
> 
>         )
> 
> I extract the original data from an SQL table:
> 
> 
> foreach ($rs->GetRows() as $k => $v)
> {
> $GRID[$v["product_code][$v["order_number"]][$v["step_number"]] =1;
> }
> 
> Please, have you an idea to display it on a table
> ( like a "pivot" table ) ?
> 
> I can't manage the RowSpan ..
> because i can have N product_code
> N order_number
> N step_number
> 
> Thanks!
> 
> -- Yena --

Hello,

if you are thinking about creating pivot tables, this could help you:

http://gonzalo123.wordpress.com/2010/01/24/pivot-tables-in-php/

regards,
johannes ke�ler
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)

iEYEARECAAYFAktm6hoACgkQE++2Zdc7Etc4SgCfTJQ3+d2GN9bMJKvQtjohztW+
hM8AmwSQLRYPb+v8/WFKSNhpEt7/2b8B
=ytDv
-----END PGP SIGNATURE-----
0
Reply ISO 2/1/2010 2:50:02 PM

2 Replies
507 Views

(page loaded in 0.04 seconds)

Similiar Articles:













7/28/2012 2:49:24 AM


Reply: