| 123456789101112131415161718 |
- <?php
- class Model_main extends Model
- {
- public function get_posts(){
- $q = "SELECT * FROM `posts` ORDER BY `updated_at` DESC";
- return $this->db->query($q);
- }
- public function create_post($caption, $post){
- $q = "INSERT INTO `posts` SET `caption` = " . $this->db->escape($caption) .
- ", `post` = " . $this->db->escape($post) .
- ", `user_id` = " . $this->db->escape($_SESSION['user']['id']);
- $this->db->query($q);
- }
- }
|