first commit
This commit is contained in:
44
application/models/editor_model.php
Executable file
44
application/models/editor_model.php
Executable file
@@ -0,0 +1,44 @@
|
||||
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class editor_model extends CI_Model
|
||||
{
|
||||
|
||||
public $table = 'partner';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->database();
|
||||
}
|
||||
|
||||
public function findById($editorId) {
|
||||
return $this->db->where('idx', $editorId)->get($this->table)->row();
|
||||
}
|
||||
|
||||
public function findAll() {
|
||||
return $this->db->from($this->table. ' l');
|
||||
}
|
||||
|
||||
public function findByCategoryId($categoryId) {
|
||||
return $this->db->from($this->table. ' p')->where_in('category_idx', $categoryId)->where('p.is_del', 'N')
|
||||
->select('p.idx editorId, p.partner_img editorImg, p.main_img editorMainImg, p.partner_name editorName, p.partner_intro editorIntro, p.category_idx categoryId');
|
||||
}
|
||||
|
||||
public function getEditors($c, $l) {
|
||||
$q = $this->db->query("SELECT
|
||||
`p`.`idx` `editorId`,
|
||||
`p`.`partner_img` `editorImg`,
|
||||
`p`.`main_img` `editorMainImg`,
|
||||
`p`.`partner_name` `editorName`,
|
||||
`p`.`partner_intro` `editorIntro`,
|
||||
`p`.`category_idx` `categoryId`
|
||||
FROM
|
||||
`partner` `p`
|
||||
WHERE
|
||||
`category_idx` IN ($c)
|
||||
AND `p`.`is_del` = 'N'
|
||||
LIMIT $l");
|
||||
return $q->result();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user