Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
I am working on datatable server side scrpting (server.php and ssp.class.php) ,
in server.php this is my code
$columns = array(
array( 'db' => 'lead_id', 'dt' => 0 ),
array( 'db' => 'lead_id', 'dt' => 1 ,'formatter' => function( $d, $row )
$user = 'root';
$password = 'test';
$mysql_database = 'testDB';
$link1 = mysqli_connect($hostname, $user, $password,$mysql_database);
$sql3 = "select user,phone_number,first_name from Test where lead_id='$d'";
$res3 = mysqli_query($link1,$sql3);
$login_UserVal = $rows3;
$phone_numberVal = $rows3;
$first_nameVal = $rows3;
return "<a onclick='window.open(\"user_profile.php?user=$login_UserVal&phone=$phone_numberVal&leadId=$d\")'>$first_nameVal</a>";
array( 'db' => 'field1', 'dt' => 2 ),
array( 'db' => 'field12', 'dt' => 3 ),
array( 'db' => 'field2', 'dt' => 4 ),
array( 'db' => 'field3', 'dt' => 5 ),
array( 'db' => 'field4', 'dt' => 6 ),
array( 'db' => 'field5', 'dt' => 7 ),
array( 'db' => 'field6', 'dt' => 8 ),
array( 'db' => 'city', 'dt' => 9 ),
array( 'db' => 'field10', 'dt' => 10 ),
array( 'db' => 'user', 'dt' => 11 )
Here index 1 column i am returning the value form another table ,
So when I do global search this index 1 column not happening remaining columns i am doing search .
This issue i did face earlier also but I did not know how to fix it ,So when I return any of the column that particuler column I am unable to gobal serach .
How can I fix this issue ,kindly help on it .
Could any one suggest on it please ?
That looks like an extremely inefficient way of doing it I'm afraid. For every row in the table you are making a new database connection and running a query. Side from not being able to search in that column, the script will start to run really slowly.
What you need is a left join. The demo SSP script doesn't support joins, but Editor's PHP libraries do and you can use them free (i.e. without an Editor license) as described here.
If you don't want to use the Editor libraries, then you need to modify the SSP class to do a left join.
@allan ,Thank you so much for your valuable time and I realy appreciated ,
Could you explain how can I modify the SSp class to do left join .
And I don't know how to to editer libraries ,so plz expain little bit on SSP class left join.
This is the class in question. You would need to modify it to add left join support. I'm afraid that is not something I can offer to do at the moment.
It looks like you're new here. If you want to get involved, click one of these buttons!
DataTables designed and created by SpryMedia Ltd.
SpryMedia Ltd is registered in Scotland, company no. SC456502.