Please make an effort to find the errors yourself it will save you a vast amount of time in the future.
// COMMENT REMOVED
Here is your amended access.php with debugging script.
try { $sql = 'SELECT COUNT(*) FROM author WHERE email = :email AND password = :password';
echo $sql; // line added to show the parameter that PDO cannot evaluate.
die; // stops program execution
$s = $pdo->prepare($sql); $s->bindValue(':email', $email); $s->bindValue(':password', $password); $s->execute(); }
I think there is a problem with the email and/or password not being set or incorrect types. Once you know which or both values are incorrect then find why the values are not being set correctly.
The OP reported the error as “Call to a member function prepare() on a non-object.” The non-object part makes me think that the problem is with the $pdo and not with the $sql.
No, this is not the problem, I tried require() instead of include() but still no success
This thing gave me this error:
Warning: Missing argument 3 for databaseContainsAuthor(), called in C:\xampp\htdocs\includes\access.php on line 16 and defined in C:\xampp\htdocs\includes\access.php on line 53
Works correctly and gives out the exact phrase in $sql, so I guess the problem is not with $sql. Problem may be in $pdo.
Warning: Missing argument 3 for databaseContainsAuthor()
Did you include the file outside the function? The error is now looking for 3 variables in the function call and it worked OK before adding the $pdo and I assume it can not find it.
Also if you use the method I posted you only need to include the pdo call once on the page not in every function.