pdo row exists code example
Example: pdo how to check if got any row
$dbServerName = "localhost";
$dbUserName = "root";
$dbPwd = "";
$dbName = "login";
try {
$con = new PDO("mysql:host=$dbServerName;dbname=$dbName; charset=utf8", $dbUserName, $dbPwd);
}
catch(PDOException $e) {
echo "connection failed: " . $e->getMessage();
}
$user_uid = "userName";
$user_pwd = "userName";
$statement = $con->prepare("SELECT * FROM users WHERE userName = (:name)");
$statement->bindParam(':name', $user_uid);
$statement->execute();
if($statement->rowCount() > 0){
while ($row = $statement->fetch()){
}
}
else{
}