PDO语句不在实时主机上工作

PDO statements work on localhost but fail to work on a live host. here is an example that works fine on localhost but rowCount() always returns 0 on a live host. someone please help me.

$stmt = $pdo->prepare("SELECT * FROM customer WHERE email = :email AND password = :password");
        $stmt->execute(array(
            ':email' => $uemail,
            ':password' => $pass
        ));
        $count = $stmt->rowCount();

PDOStatement::rowCount

PDOStatement::rowCount() returns the number of rows affected by a DELETE, INSERT, or UPDATE statement.

That does not work for SELECT, ironic but true :)

Workaround:

For most databases, PDOStatement::rowCount() does not return the number of rows affected by a SELECT statement. Instead, use PDO::query() to issue a SELECT COUNT(*) statement with the same predicates as your intended SELECT statement, then use PDOStatement::fetchColumn() to retrieve the number of rows that will be returned. Your application can then perform the correct action.

Should not even work on localhost. You're interpreting the result incorrectly on localhost.

Manual