0

I want to set the values from array inside an array to a particular column in html table. Follwing is my array structure :

    Array
(
    [page] => 1
    [results] => Array
        (
            [0] => Array
                (
                    [poster_path] => /kgLTB53HinftRRwhft7yrUOclDC.jpg
                    [adult] => 
                    [overview] => A small suburban town receives a visit from a castaway unfinished science experiment named Edward.
                    [release_date] => 1990-12-05
                    [genre_ids] => Array
                        (
                            [0] => 14
                            [1] => 18
                            [2] => 10749
                        )

                    [id] => 162
                    [original_title] => Edward Scissorhands
                    [original_language] => en
                    [title] => Edward Scissorhands
                    [backdrop_path] => /8XVovs4mLYZmmr2pgU5KYXkohcP.jpg
                    [popularity] => 4.555998
                    [vote_count] => 2549
                    [video] => 
                    [vote_average] => 7.5
                )
.
.
.

[19] => Array
                (
                    [poster_path] => /cok0SSxmD7fYeZj6l9XOr2mb0YL.jpg
                    [adult] => 
                    [overview] => A quartet of mutated humanoid turtles clash with an uprising criminal gang of ninjas
                    [release_date] => 1990-03-30
                    [genre_ids] => Array
                        (
                            [0] => 878
                            [1] => 28
                            [2] => 12
                            [3] => 35
                            [4] => 10751
                        )

                    [id] => 1498
                    [original_title] => Teenage Mutant Ninja Turtles
                    [original_language] => en
                    [title] => Teenage Mutant Ninja Turtles
                    [backdrop_path] => /v4jw4Vu87A3bDq0UoZPShteABIY.jpg
                    [popularity] => 2.46742
                    [vote_count] => 384
                    [video] => 
                    [vote_average] => 6.5
                )

        )

    [total_results] => 2699
    [total_pages] => 135
)

I want to set above array element to table with specific table attribute respectively

Following is my table structure with column name.

<table  cellspacing="0" width="100%">
      <thead>
        <tr>
          <td><b>Sr. No</b>.</td>
          <td><b>poster_path</b></td>
          <td><b>adult</b></td>
          <td><b>overview</b></td>
          <td><b>release_date</b></td>
          <td><b>genre_ids</b></td>
          <td><b>id</b></td>
          <td><b>original_title</b></td>
          <td><b>original_language</b></td>
          <td><b>title</b></td>
          <td><b>backdrop_path</b></td>
          <td><b>popularity</b></td>
          <td><b>vote_count</b></td>
          <td><b>video</b></td>
          <td><b>vote_average</b></td>
        </tr>
      </thead>
</table>
chaitali
  • 11
  • 3
  • Use `foreach` and `echo` combination. You may need to use `join` or `implode` for `genre_ids` – Thamilhan May 09 '17 at 12:26
  • So what's stopping you to do that? This is no site for hiring programmers. – MilanG May 09 '17 at 12:31
  • 3
    Possible duplicate of [How to create a HTML Table from a PHP array?](http://stackoverflow.com/questions/4746079/how-to-create-a-html-table-from-a-php-array) – Gabriel Heming May 09 '17 at 12:31

0 Answers0