CodeIgniter_Gforms/application/models/Response_model.php

21 lines
786 B
PHP
Raw Permalink Normal View History

2024-07-17 02:27:24 +00:00
<?php
class Response_model extends CI_Model {
public function get_responses($form_id) {
$this->db->select('q.question_id, q.question_text, q.question_type, ra.answer_text');
2024-07-17 10:35:29 +00:00
$this->db->from('questions q');
$this->db->join('response_answers ra', 'q.question_id = ra.question_id');
$this->db->join('responses r', 'ra.response_id = r.response_id');
2024-07-17 02:27:24 +00:00
$this->db->where('q.form_id', $form_id);
$query = $this->db->get();
return $query->result_array();
}
public function get_options($question_id) {
$this->db->select('option_id, option_text');
2024-07-17 10:35:29 +00:00
$this->db->from('options');
2024-07-17 02:27:24 +00:00
$this->db->where('question_id', $question_id);
$query = $this->db->get();
return $query->result_array();
}
}