How do i Output Two columns from mysql to one data cell
How do i Output Two columns from mysql to one data cell
![dannjoroge](https://secure.gravatar.com/avatar/dd39a1d816f3757a98fae213e0a2a16b/?default=https%3A%2F%2Fvanillicon.com%2Fdd39a1d816f3757a98fae213e0a2a16b_200.png&rating=g&size=120)
Hi am trying to output two columns from a mysql database to one cell in the datatable. how do i do that am using the server side array in php
__$columns = array(
array( 'db' => 'no', 'dt' => '0' ),
array( 'db' => 'name', 'dt' => '1' ),
array( 'db' => 'phoneno', 'dt' => '2' ),
array( 'db' => 'email', 'dt' => '3' ),
array(
'db' => 'idno',
'dt' => '4',
),
array(
'db' => 'idno',
'dt' => '5',
),
array( 'db' => 'clientno', 'dt' => '6', 'formatter' => function( $d, $row ) {
return '<a href="../clients/add_clients.php?clientid='.$row[6].'"><span class="label label-inverse"><i class="fa fa-edit"></i> Edit</span></a>';},
'field' => 'clientno' )
);__
This discussion has been closed.
Answers
You can use the render function to decorate the columns.
Here I am populating datatable #table with three columns. col1, col2 and "New Column"
New Column is merged using col3 and col4
Hope this may help.
In addition to @nava1021's excellent answer, you might also find the rendering manual page to be useful.
Allan
thanks i used a server side script using php works like a charm