<?php
class Create_model extends CI_model
{

  function getData($table='') /*Get Data*/
  {
    $this->db->from($table);
    return $this->db->get()->result_array();
  }

  function getAll() /*Get All data*/
  {
    $this->db->from('tbl_classform');
    $this->db->join('tbl_classname', 'tbl_classform.class_id = tbl_classname.class_id');
    $this->db->order_by('tbl_classform.form_id','desc');
    return $this->db->get()->result_array(); 
  }

  public function insertRow($table, $data) /*Insert Data*/
  {
    $this->db->insert($table, $data);
    return true;
  }

  function updateRow($table, $col, $colVal, $data) /*Update Data*/
  {
    $this->db->where($col,$colVal);
    $this->db->update($table,$data);
    return true;
  }

  function returnForm($form_id) /*Return Data*/
  {
    $this->db->from('tbl_classform AS A');
    $this->db->join('tbl_classname AS B', 'A.class_id = B.class_id', 'INNER');
    $this->db->join('tbl_instructors AS C', 'A.instr_id = C.instr_id', 'INNER');
    $this->db->join('tbl_classlocations AS D', 'A.locat_id = D.locat_id', 'INNER');
    $this->db->where('form_id',$form_id);
    return $this->db->get()->row();
  }

  function deleteForm($table='',$field='',$form_id='') /*Delete Form*/
  {
    $this->db->where($field,$form_id);
    $this->db->delete($table);
    return true;
  }

}
?>
