Advertisement
Guest User

Bug Agenda Sekolah

a guest
Jul 5th, 2016
658
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. public function get_agenda_sekolah() {
  2.       $start = substr($this->input->get("start"), 0, 10);
  3.       $end = substr($this->input->get("end"), 0, 10);
  4.       $data = [];
  5.       if (is_valid_date($start) && is_valid_date($end)) {
  6.          $query = $this->db->query("
  7.            SELECT post_title AS title
  8.               , post_date AS `start`
  9.            FROM posts
  10.            WHERE post_type='agenda'
  11.            AND post_date BETWEEN '$start' AND '$end'
  12.         ");
  13.      
  14.          foreach ($query->result() as $row) {
  15.                $data[] = [
  16.                   'title' => $row->title,
  17.                   'start' => $row->start
  18.                ];
  19.          }
  20.       }    
  21.       echo json_encode($data);
  22.    }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement