Codeigniter Show All Data Result



controller->blogs.php

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Blogs extends CI_Controller {
public function index() {
$data['blogs_result'] = $this->db->get('actor')->result();
$data['title'] = 'Wecome CI Framework';
$data['body'] = 'This my first body application';
$data['footer'] = 'This is my footer Application';

$this->load->view('view_blogs',$data);
}
}

view folder->view_blogs.php
<!DOCTYPE html>
<html>
<head>
<title><?= $title; ?></title>
<style type="text/css">
*{
font-family: arial;
font-size: 13px;
}
</style>
</head>
<body>
<table border="1">
<tr>
<th>ID</th>
<th>FIRST NAME</th>
<th>LAST NAME</th>
<th>DATE</th>
</tr>

<?php foreach ($blogs_result as $key => $value) { ?>
<tr>
<td><?= $value->actor_id; ?></td>
<td><?= $value->first_name; ?></td>
<td><?= $value->last_name; ?></td>
<td><?= $value->last_update; ?></td>
</tr>
<?php } ?>
</table>
</body>

</html>
Share on Google Plus

About Ram Pukar

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment

0 comments:

Post a Comment