title: Get mysqli query as a string
body: <p>I am working on a project that requires a user to log in using an email address and a password. Doing that, I must test if the password the person has entered to see if it matches the one located in the database. I'm trying to get the MySQLi query (<code>SELECT password FROM users WHERE email='$email_login'</code>) in a way I can compaire it using password_verify(). I have this PHP/MySQLi code:</p>
  
  <pre><code>$email_login = $_POST["email_login"];
  $pass_login = $_POST["pass_login"];
  if(isset($_POST["email_login"]) &amp;&amp; isset($_POST["pass_login"])) {
  
          $sql_query = mysqli_query($conn, "SELECT password FROM users WHERE email='$email_login'");
          $pass_query = print_r($sql_query, 1);
          echo $pass_query;
          $pass_test= password_verify($pass_login, $pass_query);
  
          $sql = mysqli_query($conn, "SELECT id FROM users WHERE email='$email_login' AND password='$pass_test' LIMIT 1");
  
          $userCount = mysqli_num_rows($sql);
          if($userCount == 1) {
                  while($row = mysqli_fetch_array($sql)) {
                              $id = row["id"];
                  }
                  $_SESSION["email_login"] = $email_login;
                  header("Location: index.php");
                  exit();
          } else {
                  echo "It looks like you have an issue with your credentials.";
                  exit();
          }
  }
  </code></pre>
  
  <p>Schema of database</p>
  
  <pre><code>--------------------------------------------------------------------
  id | first_name | last_name | username | email          | password |
  
  1    John         Doe         john17     john@gmail.com   (hashed)
  </code></pre>
  
  <p>and here is the form:
      </p>
  
  <pre><code>        &lt;h1&gt;Sign in&lt;/h1&gt;
          &lt;form class="form" action="&lt;?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?&gt;" method="POST"&gt;
              &lt;input type="email" name="email_login" size="25" placeholder="Email address" required&gt;
              &lt;br&gt;
              &lt;br&gt;
              &lt;input type="password" name="pass_login" placeholder="Password" required&gt;
              &lt;br&gt;
              &lt;br&gt;
              &lt;input type="submit" name="login" value="Login"&gt;
          &lt;/form&gt;
  </code></pre>
  
  <p>Everything works as it should, except for the two password_verify() lines. To try and figure out what is wrong, I printed the <code>$pass_test</code> variable as a string using print_r() and got this:</p>
  
  <pre><code>mysqli_result Object ( [current_field] =&gt; 0 [field_count] =&gt; 1 [lengths] =&gt; [num_rows] =&gt; 1 [type] =&gt; 0 )
  </code></pre>
  
  <p>Is there a safe way where I can get the result of a mysqli query in a form that can be tested using password_verify()?</p>