daily pastebin goal
22%
SHARE
TWEET

Model_Chat

a guest Jun 16th, 2013 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php defined('SYSPATH') or die('No direct script access.');
  2.  
  3. class Model_Chat extends Model
  4. {
  5.     protected $_tableChat = 'chat';
  6.  
  7.     /**
  8.      * Get comments for article
  9.      * @return array
  10.      */
  11.     public function get_chat()
  12.     {
  13.         $query = DB::select('user', 'chat_msg')
  14.                 ->from($this->_tableChat)
  15.                                 ->order_by('date', 'DESC')
  16.                 ->execute()
  17.                 ->as_array();
  18.  
  19.         if($query)
  20.             return $query;
  21.         else
  22.             return array();                      
  23.     }
  24.  
  25.     /**
  26.      * Create new comment
  27.      */
  28.     public function create_chat_msg($user, $chat_msg, $date)
  29.     {
  30.         DB::insert($this->_tableChat, array('user', 'chat_msg', 'date'))
  31.             ->values(array($user, $chat_msg, $date))
  32.             ->execute();                      
  33.     }
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top