display list of data related data in column
Posted: Tue Oct 11, 2011 8:22 pm
hello sirs,
suppose I have some list of data such as below where $fname_xyz is related to $age_xyz:
$fname_1 = dog;
$fname_2 = cat;
$fname_3 = mouse;
$age_1 = 5;
$age_2 = 10;
$age_3 = 15;
the data is not in a database. Now I want to display the above in columns with headers "animal, age, etc... and color for example, an additional column of data is there in the future"
here is what ive been able to cook up, its not working coz im trying to figure out the underscore part and use it to display the above list:
pls help
suppose I have some list of data such as below where $fname_xyz is related to $age_xyz:
$fname_1 = dog;
$fname_2 = cat;
$fname_3 = mouse;
$age_1 = 5;
$age_2 = 10;
$age_3 = 15;
the data is not in a database. Now I want to display the above in columns with headers "animal, age, etc... and color for example, an additional column of data is there in the future"
here is what ive been able to cook up, its not working coz im trying to figure out the underscore part and use it to display the above list:
Code: Select all
<?php
$d=1;
$under=_;
echo "<table border=\"1\" align=\"center\">";
echo "<tr><th>Name</th>";
echo "<th>Ages</th></tr>";
while ( $d <= 3 )
{
echo "<tr><td>";
echo $fname$under$d;
echo "</td><td>";
echo "$fname$under$d";
echo "</td></tr>";
$d = $d + 1;
}
echo "</table>";