0

I have this table in mysql, table "distance":

  id  | distance |          
  1   |    8     |  
  2   |    5     |    
  3   |    7     |  

I want output such as:

8    5   7
8    5   7
8    5   7   

How do I code it in php? Thanks, I'm a newbie in PHP.

CodeWithCoffee
  • 1,896
  • 2
  • 14
  • 36
user4716022
  • 15
  • 1
  • 5

1 Answers1

0

try like this

$tableRows[0]=array("id"=>1,"distance"=>8);
$tableRows[1]=array("id"=>2,"distance"=>5);
$tableRows[2]=array("id"=>3,"distance"=>7);
$counter=0;
foreach($tableRows as $tableRow)
{
    foreach($tableRows as $tableRow)
    {
        echo $tableRow["distance"]."\t";
    }
    echo "\n";
}

Online demo

ashkufaraz
  • 5,179
  • 6
  • 51
  • 82