Welcome Guest, Not a member yet? Register   Sign In
Number of results is wrong
#1

Hi,
I am a newbie with codeigniter 4.

I have a table with 3 entries each entry has a unique uniid. With my query I want to get the one entry with the corresponding uniid. This works but when I want to check if the result of the query has found 1 entry it doesn't work anymore, because the function countAll() always returns 3 instead of 1.

Can someone help me what I am doing wrong?


Thank you....


Code:
public function verifyUniid($id) {
  $builder = $this->db->table("users");
  $builder->select('activation_date,uniid,status');
  $builder->where('uniid',$id);
  $result=$builder->get();
  if($builder->countAll()==1){

    return $result->getRow();
  } else {
    return $builder->countAll();
  }

}
Reply


Messages In This Thread
Number of results is wrong - by Gehasi - 12-16-2020, 06:12 PM
RE: Number of results is wrong - by mlurie - 12-16-2020, 09:15 PM
RE: Number of results is wrong - by Gehasi - 12-22-2020, 06:47 PM
RE: Number of results is wrong - by demyr - 12-22-2020, 10:52 PM



Theme © iAndrew 2016 - Forum software by © MyBB