Dear DANIWEB community members,
I have a question about sorting a label, and I've tried so hard in figureing it out but I realized that I am doing something wrong but not sure what... What I am doing is sorting the numbers, which is created by the loop, that populate the array...
The first table shows all the numbers in a random order
The second table displays the numbers in order and the numbers are the ones that come from table 1.
Anyone have a clue on how to do it?
My code may have errors but can someone please help me with this
<?php
$red = array();
$x=0;
$min=900;
$max=2000;
echo "<table border=\"1\">";
for($row=1;$row<=20; $row++){
echo "<tr>\n";
for($col=1;$col<=20; $col++){
$x=rand($min,$max);
$red[$row][$col] = $x;
$blue[$row][$col]=$table[$row][$col];
echo"<td>$x</td>\n";
}
echo "</tr>";
}
sort($red);
foreach ($red as $key=> $value) {
echo $value. "<br>\n";
echo "</table>";
echo "<table border=\"1\">";
$red[$row][$col] = $x;
echo"<td>$y</td>\n";
}
echo "</tr>";
echo "</table>";
?>
<?php
sort($red);
foreach ($red as $key => $value) {
echo $value. "<br>\n";
}
?>
Please take your time and help me! If this is unclear please tell me so I can be clearer!
Thanks!,
Sedique