Recibo el siguiente error al intentar hacer coincidir valores en la base de datos con los aprobados en un formulario para verificar si existe un usuario.Error fatal capturable: el objeto de la clase PDOStatement no se pudo convertir a la cadena
Catchable fatal error: Object of class PDOStatement could not be converted to string
Este es el código que estoy usando:
//Check users login details
function match_login($username, $password){
//If the button has been clicked get the variables
try{
$dbh = new PDO("mysql:host=localhost;dbname=mjbox","root", "usbw");
} catch(PDOException $e) {
echo $e->getMessage();
}
$stmt = $dbh->prepare("SELECT * FROM mjbox WHERE username=? AND password=?");
$stmt->bindParam(1, $username);
$stmt->bindParam(2, $password);
$stmt->execute();
$result = mysql_query($stmt);
if(mysql_num_rows($result) > 0){
echo 'There is a match!';
}else{
echo 'nooooo';
}
}
se supone que usted no debe usar 'mysql_ *' si está usando PDO ........ – Esailija