Welcome Guest, Not a member yet? Register   Sign In
check if the user already have this value
#1

I have a function called send resources, so basically the admin can send a resources to a specific user and i have new table called entries which I have the FK of user_id from tables users and res_id from resource_id.

my question is how can I check if the user already have that value from res_id. I need to have a somewhat a validation thingy. I cant figure it out. can you guys help me?

this is my controller 

public function ressend() {
$db = new resource_model();

$data = array(
   'user_id' => $this->input->post('resource_send_ID'),
   'res_id' =>  $this->input->post('resource_id'),    
);

$db->insertsendResources($data); 
redirect('curator_resource');
}

this is my model

public function insertsendResources($data) {

$this->db->insert('entries', $data);

}

Attached Files Thumbnail(s)
   
Reply
#2

You would need to get the record by the users id and check the res_id and resource_id to see if they match
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB