MySQL and PHP5 / PDO do not work with row return. After your new PDO () run the release:
$dbh->setAttribute(PDO::MYSQL_ATTR_FOUND_ROWS, true);
Then it issues a request ...
$stmt = $dbh->prepare("SELECT * FROM mjbox WHERE username=? AND password=?"); $stmt->bindParam(1, $username); $stmt->bindParam(2, $password); $stmt->execute(); // number of rows returned if($stmt->rowCount()){ // ... matches }else{ // .. no match }
Otherwise, your rowCount will be either bool 0 or a null / throw error.
source share