以下代码块成功运行 - 回声“第18行0” 参数$ oginURL不存在,但不会引发错误。这是正确的行为吗?
try {
$sql = "SELECT idrecordLogins, loginAddress, loginAttempts, failedLoginAttempts FROM recordLogins
WHERE loginAddress = :loginURL" ;
$stmt = $DBH->prepare($sql);
echo "line 14 $oginURL";
$stmt->bindParam(':loginURL', $oginURL, PDO::PARAM_STR);
$stmt->setFetchMode(PDO::FETCH_OBJ);
$stmt->execute();
if ($stmt->rowcount() == 0 ) {
// add it
$x = $stmt->rowcount();
echo "line 18 $x" ;
return 'success' ;
}
else {
// update it
$x = $stmt->rowcount();
echo "line 25 $x" ;
return 'success';
}
}
catch (ErrorException $e) {
echo "line 31";
}
}