0
Guys, I’m doing a PDO login system I don’t understand much, but I’m going through this problem, I developed the following code below:
$select = $con -> prepare("SELECT * FROM conta WHERE conta = ? AND senha = ?");
$select -> bind_param("ss", $usuario->getConta(), md5($usuario->getSenha()));
$select ->execute();
$result = $select->fetch();
if($result == 1)
{
echo $result['codigo'];
echo 'success';
}
else
{
echo 'not_register';
}
Only that the return of echo $result['code'] is always empty nothing appears.
and when I give a var_dump($result) appears the result of true and nothing else and when I give a print_r($result) appears the number 1...
Does anyone have any idea how to solve?
That ain’t no PDO.
bind_param()
does not allow functions to be passed, only variables.– rray
And don’t invent a PHP password system like that. It’s full of braggart blog teaching how to use it, but it doesn’t make sense (in 2005 maybe it did). PHP has appropriate functions for this, which are password_hash and password_verify
– Bacco