I've tried to get help on this on a few forums now, but noone has been able to, or wanted to help me =) So I'll try here now...
When I extract data from mysql, I want to be able to sort it like this:
1 4 7 10
2 5 8 11
3 6 9 12
And I there are more lines extracted, it would expand like this:
1 5 9 13
2 6 10 14
3 7 11 15
4 8 12
How do I do this?
One guy who tried to help me talked about a two dimentional array, but I couldn't figure it out.
Just to se if theres anyone who might know what he was talking about, I'll post it here.
The line he gave me for this two dimetional array was:
$two_dim_array[ $i % 4 ][ intval( $i / 4 ) ] = $array[ $i ];
Just to give you the general idea on how my page work, I'll post it here also.
<?php
include("......\includes\config.inc");
$id = $_GET['category'];
$result = mysql_query("SELECT name FROM table WHERE category='$id' ORDER
BY name ASC",$db);
if ($myrow = mysql_fetch_array($result)) {
echo "<table>\n";
do {
printf("<tr>");
printf("<td>%s</td>\n", $myrow[name]);
printf("<td>%s</td>\n", $myrow[name]);
printf("<td>%s</td>\n", $myrow[name]);
printf("<td>%s</td>\n", $myrow[name]);
printf("</tr>");
} while ($myrow = mysql_fetch_array($result));
echo "</table>\n";
}
?>
As you can see, the output here is for column of the same names.
Hope there's someone who can help me out here.
-Thanks-
Jørn