Display Data in two column in Datatable

Display Data in two column in Datatable

SusanSusan Posts: 2Questions: 0Answers: 0
edited October 2011 in General
I have managed to display data in one column table, but would like to have two column instead. Is there a way of doing it? Here's the code I currently have. Although, it works, it prints in one long column and would like to break the output into two columns like so:

1 2
3 4
5 6
7 8
....

As you can tell, I'm using jQuery Datatable.

[code]
<?php
include('config.php');
mysql_connect($host, $username, $password) or die(mysql_error()) ;
mysql_select_db('people') or die(mysql_error()) ;

$data = mysql_query("SELECT * FROM names ORDER BY RAND() LIMIT 20") or die(mysql_error());
?>







/* @import "datatables/dt/media/css/demo_table.css";

.result_container{
width: 553;
} */


$(document).ready(function(){
$('#the_table').dataTable();
});






<?php

echo "


Latest names





";

while($info = mysql_fetch_array( $data )){

echo" " . $info['name'] . "
";

}
echo" ";
echo " ";
?>

[/code]

Any help would be appreciated very much.
Thank you.

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    Not directly in DataTables. but you could do it with javascript based on data that DataTables. Or on the server-side script you can process your output before returning it to DataTables (but the DataTables notion of sorting by column won't be very meaningful)
  • SusanSusan Posts: 2Questions: 0Answers: 0
    Thanks, I would have to rethink how I design my page then.
This discussion has been closed.