1

I am trying to display a multidimensional array into html table using php nd mysql.

The array structure is like below

Array
(
    [az] => Array
        (
            [0] => Array
                (
                    [work] => dsdsds
                    [time] => 2:47---2:55
                    [total] => 8
                )

        )

    [an] => Array
        (
            [0] => Array
                (
                    [work] => sdsdsdsdsd
                    [time] => 1:47---2:47
                    [total] => 60
                )

        )

    [mu] => Array
        (
            [0] => Array
                (
                    [work] => sdsdsd
                    [time] => 1:30---2:48
                    [total] => 78
                )

        )

    [raj] => Array
        (
            [0] => Array
                (
                    [work] => dsdwew
                    [time] => 3:34---3:40
                    [total] => 6
                )

            [1] => Array
                (
                    [work] => cdsfdfdfd
                    [time] => 3:25---3:35
                    [total] => 10
                )

        )

)

it will go through columns first and then it will come to rows like this

user1   user2   user3
aa      bb      cc

Plz suggest..

1
  • You should supply an example of the data, and what the output would look like using that data. Right now your data and example don't match. Commented Feb 3, 2010 at 16:36

2 Answers 2

1

U should read about foreach.

http://php.net/manual/en/control-structures.foreach.php

And I think that inserting this values into table won't be any problem.

Sign up to request clarification or add additional context in comments.

Comments

0

If i understand your question write that's what y need

    foreach($array as $tr=>$trData)
    {
      echo "<tr>{$trData["which field you want to display"]}</tr>";

      echo "<tr>";
      foreach($tdData as $td=>$tdData)
      {
         echo "<td>{$tdData["which field you want to display"]}</td>";
      }
    echo "</tr>";
    }

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.