
Untitled
By: a guest on
Apr 25th, 2012 | syntax:
PHP | size: 1.05 KB | hits: 17 | expires: Never
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class User_model extends CI_Model {
function __construct()
{
parent::__construct();
}
function allUsers($per_pg,$offset)
{
$query = $this->db->get('users',$per_pg,$offset);
return $query->result_array();
}
function usersCount()
{
return $this->db->count_all('users');
}
function insertuser()
{
$name = $this->input->post('name');
$data = array(
'name' => $this->input->post('name'),
'email' => $this->input->post('email'),
'address' => $this->input->post('address'),
'postcode' => $this->input->post('postcode'),
'phone' => $this->input->post('phone'),
'username' => $this->input->post('username'),
'password' => md5($this->input->post('password'))
);
$this->db->insert('users', $data);
$data['success'] = $this->session->set_flashdata('success', 'The user <strong>'.$name.'</strong> has been successfully inserted.');
redirect ('admin/dashboard', $data);
}