Model Dosyası (models/announcements_model.php):
[sourcecode language="php"]
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Announcements_Model extends Model {
function Announcements_Model()
{
parent::Model();
}
function get_all_records($table, $offset)
{
return $this->db->get($table, 10, $offset)->result_array();
}
function get_record ($table, $id)
{
$this->db->where('id', $id);
return $this->db->get($table)->result_array();
}
function get_all_record_count($table)
{
return $this->db->count_all($table);
}
function insert_entry($table, $data)
{
$this->db->insert($table, $data);
}
function update_entry($table, $data, $id)
{
$this->db->update($table, $data, array('id' => $id));
}
function delete_entry($table, $id)
{
return $this->db->delete($table, array('id' => $id)) ? TRUE : FALSE;
}
}
[/sourcecode]
Hiç yorum yok:
Yorum Gönder