User Login with PDO

Hello Guys
as we make user login system with this regular php code

[code]<?php
include("…/includes/connectdb.php");
$UserName = $_POST[‘UserName’];
$UserPassword = $_POST[‘Pasword’];

$strSql = “select UserID,UserName from users where UserName=’$UserName’ and UserPassword =’$UserPassword’”;
$resultlogin=mysql_query($strSql);
$intCountRecord=mysql_num_rows($resultlogin);
if($intCountRecord==1)
{
session_start();
$_SESSION[‘username’]=$UserName;
$_SESSION[‘password’]=$Password;
header(“Location:index.php”);
}
else
{
echo(“Login Successful”);
}
?>[/code]

how can we do the same thing with PDO extensions?

Please Help me

Sponsor our Newsletter | Privacy Policy | Terms of Service