Here is the table structure.
++++++++++++++++++++++++++++++++++++++++++++++
+ No + UniqueID + Email + Status +
+ 1 + 1q2w3e4r + myemail@gmail.com + NULL +
+ 2 + 12345qwe + myemail@yahoo.com + 1 +
++++++++++++++++++++++++++++++++++++++++++++++
The logic should be:
I want to input
UniqueIDandEmail. When I put the value is1q2w3e4randEmailmyemai@gmail.com, it shoudl return True or put the uniqueID as response like this one below: $this->response(array('2' => $data['UniqueID']));Same No.1 but it should return false, because i put
UniqueIDthat already hasstatus = 1.Same As No.1 and 2, but this time i put the wrong
uniqueID. eg. uniqueID is 1234567. it shoud return false because uniqueID is not true.
And my code looks like this below:
========================================================================= Solve The Problem by modify this code below:
Model
public function signup($data)
{
$this->db->select("status");
$this->db->from("mytable");
$this->db->where("UniqueID ", $data['UniqueID ']);
$this->db->where("email", $data['email']);
$q = $this->db->get();
return $q;
}
and my controller like this below:
if($result->num_rows() > 0) {
$s = $result->row()->status;
if (isset($s) && $s == 1)
{
$this->response(array('1' => 'missing data'));
} else if(!isset($s)){
$this->response(array('2' => $data['nopolis']));
}
} else {
$this->response(array('3' => 'missing'));
}