-
Notifications
You must be signed in to change notification settings - Fork 0
/
user_model.php
35 lines (32 loc) · 1.19 KB
/
user_model.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
class user_model extends CI_model{
function create()
{
$data=array(
'name' => $this->input->post('name'),
'description' => $this->input->post('description'),
'category' => $this->input->post('category'),
'author' => $this->input->post('author'),
'status' => $this->input->post('status')
);
$this->db->set($data);
$this->db->insert($this->db->dbprefix .'name');
}
function All()
{
return $this->db->get('name')->result_array(); //select from name
}
function getUser($Name) {
$this->db->where('Name',$Name);
return $user = $this->db->get('name')->row_array();
}
function updateUser($Name,$formArray) {
$this->db->where('Name',$Name);
$this->db->update('name',$formArray);
}
function deleteUser($Name) {
$this->db->where('Name',$Name);
$this->db->delete('name'); //delete from name table where Name is the key
}
}
?>