I have a mysql query that I am using to log into the database but for some reason it is returning -1 even though i put in the right values and the same query executes without the bind_param
$username = $_POST['username'];
$password = md5($_POST['password']);
$user_array = array('username' => $username,'password' => $password );
$queryname = "SELECT username, password FROM user WHERE username = ? AND password = ?";
function auth($queryname,$user_array) {
$stmt = $this->connection->prepare($queryname);
$stmt->bind_param('ss', $user, $pass);
$user=$user_array['username'];
$pass=$user_array['password'];
$stmt->execute();
return $stmt->affected_rows;
}
Any suggestions as to how i can debug this ?
SELECTquery is never going to result inaffected_rowsmysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);and watch the errors come rolling in ;)