0
<?php

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??

2
Contributors
4
Replies
16
Views
3 Years
Discussion Span
Last Post by nana.k.denise
0

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?

Edited by rubberman

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.