Db_Get_Row Returns Only First Row?

if (isset($_REQUEST['username']) && isset($_REQUEST['password'])){
     $userx = $_REQUEST['username'];
     $passx = $_REQUEST['password'];
     $user_data = db_get_row('SELECT user_id, password, salt FROM ?:users WHERE email = ?i', $userx);
  if (fn_generate_salted_password($passx, $user_data['salt']) == $user_data['password']){
      $login = true;    
  }else{
     $login = false;  
  }
 print_r($user_data);
}

can someone help me out as to why this is not grabbing the user by email and instead only returns the first row of the database?

Hi there,


Try using


$user_data = db_get_row(‘SELECT user_id, password, salt FROM ?:users WHERE email = ?s’, $userx);


TY

You can read more about placeholders here.

db_get_row - Execute query and format result as associative array with column names as keys and then return first element of this array