-3

my code is

$query1 = "SELECT `user_id` FROM `it_user` WHERE (user_email_address = ? AND user_mobile_number_verified = NULL)";
          $stmt1 = $mysqli->prepare($query1);
          $stmt1->bind_param("s",$email);
          $stmt1->execute();
          if ($stmt1->affected_rows == 1) {
            //set registration flag to 1 stating that the users mobile number is already verified

            echo '<meta http-equiv="refresh" content="0; URL=\'../signin/\'"/>';
          }
          else
          {
            $registration_flag = 2;  
            //redirect user to error page
            //echo '<meta http-equiv="refresh" content="0; URL=\'../error/\'"/>'; 
          }     

i am getting this error ::

Call to a member function bind_param() on a non-object in ***** on line 62

where as my email variable is working corrrect and also the query.

1 Answers1

0

Use NULL safe operator and write code as below:-

  $mobile = NULL; // NOTE: no quotes - using php NULL
  $query1 = "SELECT `user_id` FROM `it_user` WHERE user_email_address = ? AND user_mobile_number_verified <=> ?";
  $stmt1 = $mysqli->prepare($query1);
  $stmt1->bind_param("s",$email);
  $stmt1->bind_param($mobile);
  $stmt1->execute();

Hope it will help you :-)

Ravi Hirani
  • 6,511
  • 1
  • 27
  • 42