Welcome Guest, Not a member yet? Register   Sign In
problem in form_validation using is_callable(), cannot passing data from controller
#6

(This post was last modified: 04-16-2019, 08:26 AM by dave friend.)

(04-15-2019, 09:49 PM)DELE Wrote: why does it not return object values? instead returns a null value? and how do I overcome that using the is_callable() method?

It returns no object because no record in the database satisfied the where condition. In other words, there is no data to turn into an object.

Perhaps the easiest solution is to have the callback respond in a logical way when its argument is null.

Oh... and for what it's worth. The following

PHP Code:
public function check_role($email){
 
   if ($email->user_role == 0) {
 
       return false;
 
   }
 
   return true;



would be much more concise if written like this

PHP Code:
public function check_role($email){
 
   return $email->user_role != 0;


Or, if you want to account for the argument possibly being null

PHP Code:
public function check_role($email){
 
   return ! empty($email->user_role);

Reply


Messages In This Thread
RE: problem in form_validation using is_callable() - by dave friend - 04-16-2019, 08:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB