Skip to Content
PHPCODE
CodeIgniter Pagination
codeigniter code / August 3, 2018
Pagination in Codeigniter

step 1:- Created function in model

public function num_rows()
{
$user_id=$this->session->userdata('user_id');
$query=$this->db
->select(['title','id'])
->from('articles')
->where('user_id',$user_id)
->get();
return $query->num_rows();
}

step 2:- edit model function

public function articles_list($limit,$offset)
{
$user_id=$this->session->userdata('user_id');
$query=$this->db
->select(['title','id'])
// ->select('id')
->from('articles')
->where('user_id',$user_id)
->limit($limit,$offset)
->get();
return $query->result();
}

step 3: Created Controller function

public function dashboard()
{
$this->load->library('pagination');
$this->load->model('articlesmodel',"articles");
$config=[
'base_url' => base_url('admin/dashboard'),
'per_page'  => 5,
'total_row' => $this->articles->num_rows(),
];
$this->pagination->initialize($config);
$this->load->helper('form');
$articles=$this->articles->articles_list($config['per_page'],$this->uri->segment(3));
$this->load->view('admin/dashboard',['articles'=>$articles]);
}

step 4 : create view in function write

 </table>
<?= $this->pagination->create_links(); ?> 

 

Comments
Damion Burt says:

PLEASE F0RWARD THiS EMAiL To SoME0NE iN Y0UR CoMPANY WH0 iS ALL0WED T0 MAKE IMPORTANT DECiSi0NS!

We have hacked y0ur website https://phpcodeinformation.com and extracted your databases.

H0w did this happen?

our team has found a vulnerability within y0ur site that we were able t0 expl0it. After finding the vulnerability we were able to get your database credentials and extract y0ur entire database and move the inf0rmation to an 0ffsh0re server.

What does this mean?

We will systematically go thr0ugh a series 0f steps 0f t0tally damaging your reputation. First your database will be leaked or sold t0 the highest bidder which they will use with whatever their intenti0ns are. Next if there are e-mails f0und they will be e-mailed that their inf0rmation has been s0ld or leaked and y0ur site https://phpcodeinformation.com was at fault thusly damaging y0ur reputation and having angry customers/associates with whatever angry customers/ass0ciates d0. Lastly any links that y0u have indexed in the search engines will be de-indexed based off 0f blackhat techniques that we used in the past t0 de-index 0ur targets.

How d0 i st0p this?

We are willing to refrain from destroying y0ur site’s reputation for a small fee. The current fee is $3000 in bitcoins (.16 BTC).

Please send the bitcoin t0 the foll0wing Bitcoin address (Make sure t0 c0py and paste):

3J4iVcmU1RU6R1f5zw2i7yjFwbichXAyQQ

once you have paid we will aut0matically get inf0rmed that it was your payment. Please n0te that you have to make payment within 5 days after receiving this e-mail 0r the database leak, e-mails dispatched, and de-index 0f your site WiLL start!

H0w do i get Bitcoins?

Y0u can easily buy bitcoins via several websites or even 0ffline fr0m a Bitcoin-ATM.

What if i don’t pay?

if y0u decide n0t to pay, we will start the attack at the indicated date and uph0ld it until y0u do, there’s no counter measure to this, y0u will 0nly end up wasting more m0ney trying to find a solution. We will c0mpletely destr0y y0ur reputati0n am0ngst g0ogle and your customers.

This is not a h0ax, do n0t reply t0 this email, d0n’t try t0 reason 0r neg0tiate, we will not read any replies. once y0u have paid we will stop what we were doing and y0u will never hear fr0m us again!

Please n0te that Bitcoin is anonymous and no 0ne will find 0ut that you have complied.

Leave a Reply

Your email address will not be published.

PHPCODE © 2023