Mysql select for table 5 per line

advertisements

how i can Select from mysql_db to table limit by 5. 5 per line. I have:

1
2
3
4
5
6
7
8
9
10
11
12
13
14

i need:

1 6 11
2 7 12
3 8 13
4 9 14
5 10

or :

1 2 3 4 5
6 7 8 9 10
11 12 13 14

thank you.


Try to adapte this function according to your case :

<?php
$array=array('a','b','c','d','e','f','g');

function display($array,$limite){
    $arrays= array_chunk($array, $limite);
    foreach($arrays as $array){
    echo implode(' ',$array).'<br/>';
    }
}
display($array,2);
?>

Output of display($array,2);

a b
c d
e f
g

Output of display($array,3);

a b c
d e f
g