Fehler im DataTable-ModellPhp

PHP-Programmierer chatten hier
Anonymous
 Fehler im DataTable-Modell

Post by Anonymous »

Dies ist mein Datentabellenmodell, das alle Tabellen kombiniert, die ich benötige, und die Konsole hat in diesem Code einen Fehler gefunden, bei dem VehicleNo nicht eindeutig ist.

Image


Ich muss auch nach ApplicationNo sortieren und die ApplicationNo unterscheiden, damit keine andere Tabelle dupliziert wird

Code: Select all

private function _get_datatables_query(){
if($this->input->post('Status'))
{
$this->db->where('Status', $this->input->post('Status'));
}
$this->db->select('*');
//$this->db->distinct('ApplicationNo');
$this->db->from($this->table);
$this->db->distinct();
$this->db->join('user', 'user.userId = loanapplication.userId');;
$this->db->join('collateraldetails', 'collateraldetails.ApplicationNo = loanapplication.ApplicationNo');
$this->db->join('vehicleinformation', 'vehicleinformation.VehicleNo = collateraldetails.VehicleNo');
$this->db->join('loanrequest', 'loanrequest.ApplicationNo = loanapplication.ApplicationNo');
$this->db->join('loanapproval', 'loanapproval.RequestNo = loanrequest.RequestNo');
$this->db->join('paymentdetails', 'paymentdetails.ApplicationNo = loanapplication.ApplicationNo');
$this->db->join('loanpayment', 'loanpayment.PaymentId = paymentdetails.PaymentId');
//echo $this->db->last_query();exit;

$i = 0;

foreach ($this->column_search as $item) // loop column
{
if($_POST['search']['value']) // if datatable send POST for search
{
if($i===0) // first loop
{
// open bracket. query Where with OR clause better with bracket. because maybe can combine with other WHERE with AND.
$this->db->group_start();
$this->db->like($item, $_POST['search']['value']);
}
else
{

$this->db->or_like($item, $_POST['search']['value']);
}

if(count($this->column_search) - 1 == $i) //last loop
$this->db->group_end(); //close bracket
}
$i++;
}

if(isset($_POST['ApplicationNo'])) // here order processing
{
$this->db->order_by($this->column_order[$_POST['ApplicationNo']['0']['column']], $_POST['ApplicationNo']['0']['dir']);
}
else if(isset($this->ApplicationNo))
{

$ApplicationNo = $this->ApplicationNo;
$this->db->order_by(key($ApplicationNo), $ApplicationNo[key($ApplicationNo)]);
}}

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post