<?php
require_once "../database.php";
if ($stmt = $con->prepare('SELECT email FROM users WHERE email = ?')) {
 // Bind parameters (s = string, i = int, b = blob, etc), in our case the username is a string so we use "s"
 $stmt->bind_param('s', $_POST['email']);
 $stmt->execute();
 // Store the result so we can check if the account exists in the database.
 $stmt->store_result();
 if ($stmt->num_rows > 0) {
  echo "ok";
 } else {
  // Incorrect username
  echo "error";
 }
 $stmt->close();
}
