Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class ArticlesCatmodel
- {
- public function Get($extra='')
- {
- $cats = array();
- System::Get('db')->Execute("SELETE * FROM `articles_cats` {$extra}");
- if(System::Get('db')->AffectedRows()>0)
- {
- $cats = System::Get('db')->GetRows();
- }
- return $cats;
- }
- // return one article
- public function Get_By_Id($cid)
- {
- $cid = (int)$id;
- $cat = $this->Get("WHERE `cid`=$cid") ;
- return $cat[0];
- }
- public function Add($data)
- {
- if(System::Get('db')->Insert('aticles_cats',$data)){
- return TRUE;
- }
- return FALSE;
- }
- public function Update($cid,$data)
- {
- $cid=(int)$cid;
- if(System::Get('db')->Update('aticles_cats',$data,"WHERE `id` = $id")){
- return TRUE;
- }
- return FALSE;
- }
- public function Delete($cid)
- {
- $cid =(int)$cid;
- if(System::Get('db')->Delete('aticles_cats',"WHERE `cid` = $cid")){
- return TRUE;
- }
- return FALSE;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement