Welcome Guest, Not a member yet? Register   Sign In
Result and Sort by Date
#1

(This post was last modified: 09-03-2019, 05:49 PM by incognitorecon.)

Result and Sort by Date
This is my ControlleR:
Code:
$data['reg'] = $this->register->registerAcc($schoolID);
$data['upd'] =$this->register->UpdateAcc($schoolID);
$data['sus'] =$this->register->suspendAcc($schoolID);
$this->load->view('account/accountInfo',$data);

This is my View Code: 
Code:
<thead style="width:300px;">
<th>Date</th>
<th>Function</th>
<th>UserName</th>
</thead>
<?php
foreach ($reg as $row) { ?>
<tr>
<td ><?php echo $row->registerDate;?></td>
<td><?php echo $row->registerStatus></td>
<td><?php echo $row->registerUserName></td>
</tr>
<?php
foreach ($upd as $row) { ?>
<tr>
<td ><?php echo $row->UpdateDate;?></td>
<td><?php echo $row->UpdateStatus></td>
<td><?php echo $row->UpdateUserName></td>
</tr>
<
?php
foreach ($sus as $row) { ?>
<tr>
<td ><?php echo $row->SuspendDate;?></td>
<td><?php echo $row->SuspendStatus></td>
<td><?php echo $row->SuspendUserName></td>
</tr>

But i have a problem , when i show in the page the list will go from
Code:
Date           Function       UserName
05-09-2019  Register    Tom
04-09-2019  Register    Bors
01-09-2019  Register    Berry
03-09-2019  Update      Laxy   
05-09-2019  Suspend     Loi
What i wanted is
Code:
Date           Function       UserName
05-09-2019  Register    Tom
05-09-2019  Suspend     Loi
04-09-2019  Register    Bors
03-09-2019  Update      Laxy   
01-09-2019  Register    Berry
below is my model 
Code:
public function registerAcc($schoolID){
$this->db->select('*');
$this->db->from('registerdata');
$this->db->where('school_ID',$schoolID);
$this->db->order_by('registerDateTime','DESC');
$query = $this->db->get();
return $result = $query->result();
}

public function UpdateAcc($schoolID){
$this->db->select('*');
$this->db->from('UserUpdateLog');
$this->db->where('school_ID',$schoolID);
$this->db->order_by('updateLog','DESC');
$query = $this->db->get();
return $result = $query->result();
}

public function suspendAcc($schoolID){
$this->db->select('*');
$this->db->from('SuspendedData');
$this->db->where('school_ID',$schoolID);
$this->db->order_by('suspendLog','DESC');
$query = $this->db->get();
return $result = $query->result();
}

Any idea ?
Reply


Messages In This Thread
Result and Sort by Date - by incognitorecon - 09-03-2019, 01:55 AM
RE: Result and Sort by Date - by dave friend - 09-03-2019, 11:57 AM
RE: Result and Sort by Date - by incognitorecon - 09-03-2019, 05:50 PM
RE: Result and Sort by Date - by php_rocs - 09-04-2019, 08:06 AM
RE: Result and Sort by Date - by includebeer - 09-04-2019, 09:47 AM
RE: Result and Sort by Date - by dave friend - 09-04-2019, 10:28 AM
RE: Result and Sort by Date - by includebeer - 09-04-2019, 12:42 PM
RE: Result and Sort by Date - by dave friend - 09-04-2019, 02:57 PM
RE: Result and Sort by Date - by includebeer - 09-05-2019, 10:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB