MIF_E31211879/application/models/ModelPertanyaan.php

39 lines
1.0 KiB
PHP

<?php
defined('BASEPATH') or exit('No direct script access allowed');
class ModelPertanyaan extends CI_Model
{
public function __construct()
{
parent::__construct();
//Codeigniter : Write Less Do More
}
public function get_data()
{
return $this->db->get_where("pertanyaan")->result();
}
public function get_data_edit($id)
{
return $this->db->get_where("pertanyaan", array("id_pertanyaan" => $id))->row_array();
}
public function get_jawaban_edit($id)
{
return $this->db
->join("pertanyaan", "pertanyaan.id_pertanyaan = jawaban.id_pertanyaan")
->where("jawaban.id_pertanyaan", $id)
->get("jawaban")
->row_array();
}
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();
}
}