<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Penalties_model extends CI_Model {

	function __construct()
    {
     parent::__construct();		
	
    }
	
	//pull all penalties for members in the give corporation
	//SELECT * FROM saccoManager.penalties WHERE user_id IN(SELECT user_id FROM saccoManager.users WHERE corporation_id = $corp_id);
	function get_all_penalties($corp_id)
	{
		$penaltiesQuery = "SELECT * FROM saccoManager.penalties WHERE user_id IN(SELECT user_id FROM saccoManager.users WHERE corporation_id = {$corp_id});";
		
		$query = $this->db->query($penaltiesQuery);
		
		if($query->result_array())
		 {
		 	return $query->result();
		 }
		 else
		 {
			 return NULL;
		 }
		
	}
	
}

?>