Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Controllers;
- use CodeIgniter\Controller;
- class aktiflog extends Controller
- {
- public function __construct()
- {
- $this->session = session();
- $this->db = \Config\Database::connect();
- $this->log = model('App\Models\log');
- }
- public function index()
- {
- $JumlahMaksimalDitampilkan=10;
- $BarisLamaYangMauDihapus=0;
- $logshow = $this->log->asObject()->where('log_userid',$_SESSION['user_login'])->orderBy('log_id','DESC')->find();
- if(count($logshow)>$JumlahMaksimalDitampilkan){$BarisLamaYangMauDihapus=count($logshow)-10;}
- echo 'Menampilkan semua data USERID untuk dihitung berapa jumlahnya (Diurutkan paling baru diatas)<br/>';
- $noshow=0;
- foreach($logshow as $logs){
- $noshow++;
- echo 'No.'.$noshow.' (ID'.$logs->log_id.' USERID'.$logs->log_userid.')<br/>';
- }
- echo '<br/>Jika data diatas jumlahnya lebih dari '.$JumlahMaksimalDitampilkan.', maka urutan selanjutnya akan dihapus<br/><br/><br/>';
- $log = $this->log->asObject()->where('log_userid',$_SESSION['user_login'])->orderBy('log_id','ASC')->limit($BarisLamaYangMauDihapus)->find();
- echo 'Data dibawah akan dihapus yang sudah diurutkan paling lama<br/>';
- $nodel=$JumlahMaksimalDitampilkan;
- foreach($log as $logs){
- $nodel++;
- echo 'No.'.$nodel.' (ID'.$logs->log_id.' USERID'.$logs->log_userid.')<br/>';
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement