if (isset($_POST['Login'])){

$Username = $_POST[ 'UserName' ];
$password = $_POST[ 'Password' ];
$user = 'localhost';
$pass = '';
$db = new PDO('mysql:host=localhost;dbname=ovs', $user, $pass );
$sql = "SELECT * FROM Voters WHERE UserName=:UserName";

$query = $db->prepare( $sql );
$query->execute( array( ':Username'=>$UserName ) );
$results = $query->fetchAll( PDO::FETCH_ASSOC ); 

foreach( $results as $row ){ 
    $password_hash = $row[ 'password' ];
    print_r( $password_hash );

$login_query3=mysql_query("select * from voters where Username='$UserName' and Password='$Password' and Status='Unvoted' and Year='2nd year'") or die(mysql_error());


tried this code in my login area but seems not to be working.what am i missing out on??

Well, first of all you are missing some logic and a } for this line:
if (isset($_POST['Login'])){

BTW, what version of PHP are you running?

Version 5.what? I run 5.5.4, and the default on my RedHat Enterprise systems is 5.3.3. In any case, run php from the command line like this: php -l filename.php
That will syntax-check your code.