Skip to Content
CodeIgniter Fetching & Listing Articles in AdminPanel
codeigniter code / July 29, 2018

Fetching & Listing Articles in Adminpanel

Step 1 :-Create file Articlesmodel in Models
For Example
class Articlesmodel extends CI_Model
public function articles_list()
return $query->result();
Step 2 :- Create file admin in view
For Example
class Admin extends MY_Controller
public function dashboard()
Step 3 :- Create file Dashboard in view
<?php include_once(‘admin_header.php’);?>
<div class=”container”>
<table class=”table”>
<th>Sr. No.</th>
<?php if(count($articles)):?>
<?php foreach($articles as $article):?>
<td>Article Title</td>
<a href=”#” class=”btn btn-primary”>Edit</a>
<a href=”#” class=”btn btn-danger”>Delete</a>
<?php endforeach; ?>
<?php else:?>
<td colspan=”3″>Not Record Found</td>
<?php endif; ?>
<?php include_once(‘admin_footer.php’);?>

No comments yet, take the initiative.

Leave a Reply

Your email address will not be published.

PHPCODE © 2023