Welcome Guest, Not a member yet? Register   Sign In
num_rows() from CI3 on CI4
#1

Hi again,
I have been having problems in verifying if a database record exists by selecting it and returning his row, and then proceed to count the number of rows deciding true(if number of rows bigger than 0) and false(else)

Can you give me a hint, I feel like I'm missing something really simple, and I am typing unnecessary code.
Thank you, the your time.

PHP Code:
public static function verify_user_by_cod($cod)
  {

    $db db_connect();
    $builder $db->table('users');

    $builder->select('*');
    $builder->where('cod_user'$cod);
    $query $builder->get();

    
    
if (count($query->getResultArray()) > 0) {
      return true;
    } else {
      return false;
    }
  
Reply


Messages In This Thread
num_rows() from CI3 on CI4 - by joseCarlos - 04-22-2020, 04:14 AM
RE: num_rows() from CI3 on CI4 - by jreklund - 04-22-2020, 10:15 AM
RE: num_rows() from CI3 on CI4 - by joseCarlos - 04-22-2020, 10:40 AM
RE: num_rows() from CI3 on CI4 - by jreklund - 04-22-2020, 11:08 AM
RE: num_rows() from CI3 on CI4 - by sneakyimp - 12-28-2020, 03:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB