So according to a suggestion I am trying to include prepared statements.
But PHP doesn't accept my code.
$stmt = $link->prepare('SELECT COUNT(*) FROM `table` WHERE `company` = CONVERT( _utf8 \'?\' USING latin1 ) COLLATE latin1_german1_ci AND `password` = CONVERT( _utf8 \'?\' USING latin1 ) COLLATE latin1_german1_ci');
$stmt->bind_Param('ss', $firmaP, $kennwP);
$firmaP = utf8_encode($_POST['company']);
$kennwP = utf8_encode($_POST['password']);
if ($stmt->execute()) {
if($row = $stmt->fetch()) {
echo "OK";
}
else
{
echo "NO";
}
}
I get
Warning: mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters in prepared statement
Whereas I have two questionmarks in the query and two variables in bind_Param.
How to solve this?
EDIT: Replacing \'?\' with ? leads to
Fatal error: Call to a member function bind_param() on a non-object
Don't quote your
?
s as follows: