Explode data in ssp and search foreign key
Explode data in ssp and search foreign key
AmitaSingh
Posts: 6Questions: 2Answers: 0
Hi,
How can i explode data in ssp. I have save my data in database with ',' and these data is a foreign key.
And search is not working for foreign key. Ex: foreign key is 526, and its value is "PHP" so i want to search 'PHP'.
I have a lots of foreign key row and i want to search with actual value.
Sorry for my English.
$columns = array(
array( 'db' => 'r_id', 'dt' => 0 ),
array(
'db' => 'receiving_date',
'dt' => 1,
'formatter' => function( $d, $row ) {
return date( 'd-m-Y', strtotime($d));
}
),
array(
'db' => 'invoice_no',
'dt' => 2,
'formatter' => function( $d, $row ) {
return return_invoice_no($d);
}
),
array( 'db' => 'job_no', 'dt' => 3 ),
array(
'db' => 'client',
'dt' => 4,
'formatter' => function( $d, $row ) {
return return_clients_name($d);
}
),
// Java script
$(document).ready(function(){
var dataTable = $('#dataTable').DataTable({
"bProcessing": true,
"bServerSide": true,
"order": [[0, 'desc']],
"ajax":{
url:"server_side/fetch_payment_receiving.php",
type:"post"
},
"fnRowCallback" : function(nRow, aData, iDisplayIndex){
$("td:first", nRow).html(iDisplayIndex +1);
return nRow;
}
});
});
Database image
This discussion has been closed.
Answers
Sounds like you want a join? If so, then the SSP class doesn't support that I'm afraid, but Editor's PHP libraries do have a
leftJoin
method which could be used. Sandy wrote a blog post a few weeks ago explaining how the Editor libraries can be used, even without Editor.Allan
Hi Allan,
Thanx for reply.
No i am not looking for join. I save data in one table with foreign key and i am using using function to return the foreign key. Like return_invoice_no.
In the table client come from client table, invoice no come to another table and so on.
Invoice no insert in implode format.
I am facing two issue.
1. How i print implode invoice no( previous attached image)
2. Foreign key search
I am using ssp.
Thank You
That is what made me assume you would want a join. I don't see how else you could search for PHP and get the records which are id 526? Does your function do that join lookup?
If would help if you could show me your database schema here as I don't really understand what you are looking for I'm afraid.
It already looks imploded in the image? It is comma separated? What do you want it to be?
Allan
I have a similar need.
I have a list of products and a "Campaign" table containing a field with a comma separated list of products.
In the datatables table there should be a list of product's names, not ids.
How's that achievable?
I think this will answer to AmitaSingh's question too.
Thanks