Would be really appreciated your help.I have a code like this: i need to display a total figure for passengers carried on each route and in each month and highlight in green the best performing route and highlight in red the worst performing route.I constraced those tables and now stack.

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<?php
$shop = array( 
               array("Airport"=>"Hartsfield Jackson Atlanta International", "city"=>"Atlanta" , "Code"=>"ATL"),
               array("Airport"=>"Chicago O'Hare International", "city"=>"Chicago" , "Code"=>"ORD"),
               array("Airport"=>"Los Angeles International", "city"=>"Los Angeles" , "Code"=>"LAX"),
               array("Airport"=>"Dallas Fort Worth International", "city"=>"Dallas-Fort Worth" , "Code"=>"DFW"),
               array("Airport"=>"Denver  International", "city"=>"Denver" , "Code"=>"DEN"),
               array("Airport"=>"John F Kennedy  International", "city"=>"New York" , "Code"=>"JFK"),
               array("Airport"=>"San Francisco ", "city"=>"San Francisco" , "Code"=>"SFO"),
               array("Airport"=>"Charlotte Douglas ", "city"=>"Charlotte" , "Code"=>"CLT"),
               array("Airport"=>"McCarran International", "city"=>"Las Vegas" , "Code"=>"LAS"),
               array("Airport"=>"Phoenix Sky Harbor  International", "city"=>"Phoenix" , "Code"=>"PHX"),
             ); 
?>
<?php if (count($shop) > 0): ?>
    <div class="container">
        <style type="text/css">
table { width: 50%; }
</style>
<table  BORDER=1 BORDERCOLOR=green>
  <thead>
    <tr bgcolor= GREEN>
      <th ><?php echo implode('</th><th>', array_keys(current($shop))); ?></th>
    </tr>
  </thead>
  <tbody>
<?php foreach ($shop as $row): array_map('htmlentities', $row); ?>
    <tr>
      <td><?php echo implode('</td><td>', $row); ?></td>
    </tr>
<?php endforeach; ?>
  </tbody>
</table>
        </div>
<?php endif; ?>
    <?php
$data = array( 
               array(""=>"January", "ATL"=>rand(0,335) , "ORD"=>rand(0,335),"LAX"=>rand(0,335),"DFW"=>rand(0,335),"DEN"=>rand(0,335),"JFK"=>rand(0,335),"SFO"=>rand(0,335),"CLT"=>rand(0,335),"LAS"=>rand(0,335),"PHX"=>rand(0,335)),
               array(""=>"February", "ATL"=>rand(0,335) , "ORD"=>rand(0,335),"LAX"=>rand(0,335),"DFW"=>rand(0,335),"DEN"=>rand(0,335),"JFK"=>rand(0,335),"SFO"=>rand(0,335),"CLT"=>rand(0,335),"LAS"=>rand(0,335),"PHX"=>rand(0,335)),
               array(""=>"March", "ATL"=>rand(0,335) , "ORD"=>rand(0,335),"LAX"=>rand(0,335),"DFW"=>rand(0,335),"DEN"=>rand(0,335),"JFK"=>rand(0,335),"SFO"=>rand(0,335),"CLT"=>rand(0,335),"LAS"=>rand(0,335),"PHX"=>rand(0,335)),
               array(""=>"April", "ATL"=>rand(0,335) , "ORD"=>rand(0,335),"LAX"=>rand(0,335),"DFW"=>rand(0,335),"DEN"=>rand(0,335),"JFK"=>rand(0,335),"SFO"=>rand(0,335),"CLT"=>rand(0,335),"LAS"=>rand(0,335),"PHX"=>rand(0,335)),
               array(""=>"May", "ATL"=>rand(0,335) , "ORD"=>rand(0,335),"LAX"=>rand(0,335),"DFW"=>rand(0,335),"DEN"=>rand(0,335),"JFK"=>rand(0,335),"SFO"=>rand(0,335),"CLT"=>rand(0,335),"LAS"=>rand(0,335),"PHX"=>rand(0,335)),
               array(""=>"June", "ATL"=>rand(0,335) , "ORD"=>rand(0,335),"LAX"=>rand(0,335),"DFW"=>rand(0,335),"DEN"=>rand(0,335),"JFK"=>rand(0,335),"SFO"=>rand(0,335),"CLT"=>rand(0,335),"LAS"=>rand(0,335),"PHX"=>rand(0,335)),
               array(""=>"July", "ATL"=>rand(0,335) , "ORD"=>rand(0,335),"LAX"=>rand(0,335),"DFW"=>rand(0,335),"DEN"=>rand(0,335),"JFK"=>rand(0,335),"SFO"=>rand(0,335),"CLT"=>rand(0,335),"LAS"=>rand(0,335),"PHX"=>rand(0,335)),
               array(""=>"August", "ATL"=>rand(0,335) , "ORD"=>rand(0,335),"LAX"=>rand(0,335),"DFW"=>rand(0,335),"DEN"=>rand(0,335),"JFK"=>rand(0,335),"SFO"=>rand(0,335),"CLT"=>rand(0,335),"LAS"=>rand(0,335),"PHX"=>rand(0,335)),
               array(""=>"September", "ATL"=>rand(0,335) , "ORD"=>rand(0,335),"LAX"=>rand(0,335),"DFW"=>rand(0,335),"DEN"=>rand(0,335),"JFK"=>rand(0,335),"SFO"=>rand(0,335),"CLT"=>rand(0,335),"LAS"=>rand(0,335),"PHX"=>rand(0,335)),
               array(""=>"October", "ATL"=>rand(0,335) , "ORD"=>rand(0,335),"LAX"=>rand(0,335),"DFW"=>rand(0,335),"DEN"=>rand(0,335),"JFK"=>rand(0,335),"SFO"=>rand(0,335),"CLT"=>rand(0,335),"LAS"=>rand(0,335),"PHX"=>rand(0,335)),
               array(""=>"November", "ATL"=>rand(0,335) , "ORD"=>rand(0,335),"LAX"=>rand(0,335),"DFW"=>rand(0,335),"DEN"=>rand(0,335),"JFK"=>rand(0,335),"SFO"=>rand(0,335),"CLT"=>rand(0,335),"LAS"=>rand(0,335),"PHX"=>rand(0,335)),
               array(""=>"December", "ATL"=>rand(0,335) , "ORD"=>rand(0,335),"LAX"=>rand(0,335),"DFW"=>rand(0,335),"DEN"=>rand(0,335),"JFK"=>rand(0,335),"SFO"=>rand(0,335),"CLT"=>rand(0,335),"LAS"=>rand(0,335),"PHX"=>rand(0,335)),
             ); 
?>
      <br> 
<?php if (count($data) > 0): ?>
    <div class="container">
        <style type="text/css">
table { width: 50%; }
</style>
<table  BORDER=1 BORDERCOLOR=green>
  <thead>
    <tr bgcolor= GREEN>
      <th ><?php echo implode('</th><th>', array_keys(current($data))); ?></th>
    </tr>
  </thead>
  <tbody>
<?php foreach ($data as $row): array_map('htmlentities', $row); ?>
    <tr>
      <td><?php echo implode('</td><td>', $row); ?></td>
    </tr>
<?php endforeach; ?>
  </tbody>
</table>
        </div>
<?php endif; ?>
    </body>
</html>

You need to give us more information. What exactly are you stuck on? What is going wrong?

RE:the problem is ,how can i calculate the average per row and column? I having problem with nested for loops.So as you can se i have only tables generated,but did not do any calculations as described in the first place.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.