Cloudlog/application/models/Note.php

48 wiersze
976 B
PHP
Czysty Zwykły widok Historia

2011-07-22 00:08:47 +00:00
<?php
class Note extends CI_Model {
function __construct()
{
// Call the Model constructor
parent::__construct();
}
function list_all() {
return $this->db->get('notes');
}
function add() {
$data = array(
'cat' => xss_clean($this->input->post('category')),
'title' => xss_clean($this->input->post('title')),
'note' => xss_clean($this->input->post('content'))
2011-07-22 00:08:47 +00:00
);
$this->db->insert('notes', $data);
}
function edit() {
$data = array(
'cat' => xss_clean($this->input->post('category')),
'title' => xss_clean($this->input->post('title')),
'note' => xss_clean($this->input->post('content'))
2011-07-22 00:08:47 +00:00
);
$this->db->where('id', xss_clean($this->input->post('id')));
2011-07-22 00:08:47 +00:00
$this->db->update('notes', $data);
}
function delete($id) {
$this->db->delete('notes', array('id' => xss_clean($id)));
2011-07-22 00:08:47 +00:00
}
function view($id) {
// Get Note
$this->db->where('id', xss_clean($id));
2011-07-22 00:08:47 +00:00
return $this->db->get('notes');
}
}
?>