39 lines
1004 B
PHP
39 lines
1004 B
PHP
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class ModelJawaban extends CI_Model
|
|
{
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
//Codeigniter : Write Less Do More
|
|
}
|
|
|
|
public function get_data()
|
|
{
|
|
return $this->db->get_where("jawaban")->result();
|
|
}
|
|
|
|
public function get_data_edit($id)
|
|
{
|
|
return $this->db->get_where("jawaban", array("id_jawaban" => $id))->row_array();
|
|
}
|
|
|
|
public function get_jawaban_edit()
|
|
{
|
|
return $this->db
|
|
->select('*')
|
|
->from('jawaban')
|
|
->join('pertanyaan', 'pertanyaan.id_pertanyaan = jawaban.id_pertanyaan', 'left')
|
|
->get()->result();
|
|
}
|
|
public function get_data2()
|
|
{
|
|
return $this->db
|
|
->join("user","user.id_user=pertanyaan.id_user")
|
|
->join("jawaban","jawaban.id_pertanyaan=pertanyaan.id_pertanyaan")
|
|
->where("pertanyaan.is_answer", "1")
|
|
->get("pertanyaan")->result();
|
|
}
|
|
} |