Basically I am not exactly sure how to fetch the query in order to be able to count the number of rows.
I need the get the number of rows for the purpose of a checker.
Code below:
$query = $handler->prepare("SELECT * FROM Admins WHERE ID= :userID OR Username= :userName OR Password= :encPass");
$query->bindParam(':userID', $userID);
$query->bindParam(':userName', $userName);
$query->bindParam(':encPass', $encrypted_password);
$query->execute();
some how right here fetch in a way that lets me count the number of rows
if (number of rows from query is >=1){
PDOStatement
object provides a rowCount()
method, which returns the number of rows SELECT
ed:
If the last SQL statement executed by the associated
PDOStatement
was aSELECT
statement, some databases may return the number of rows returned by that statement. However, this behaviour is not guaranteed for all databases and should not be relied on for portable applications.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.