Jump to content

how do i convert this to PDO....HELP


denndeal2007

Recommended Posts

hello everyone..how do i code PDO for this script...please help me <?php if (isset($_POST['Login'])){ $UserName=$_POST['UserName']; $Password=$_POST['Password']; $hostname = 'localhost'; $username = 'root'; $password = ''; $database_name = 'ovs'; $mysqli = new mysqli($hostname, $username,$password, $database_name); $login_query=mysqli_query($mysqli,"select * from voters where Username='$UserName' and Password='$Password' and Status='Unvoted' and Year='1st year'") or die(mysqli_error()); $login_query1=mysqli_query($mysqli,"select * from voters where Username='$UserName' and Password='$Password' and Status='Voted'"); $count=mysqli_num_rows($login_query); $count1=mysqli_num_rows($login_query1); $row=mysqli_fetch_assoc($login_query); $id=$row['VoterID']; ?>index.php

 

Link to comment
Share on other sites

Learn the syntax for PDO and then do the same thing for it.

 

Here are pages on the PHP manual about how to use PDO:

Connections: http://es1.php.net/manual/en/pdo.connections.php

Prepared statements: http://es1.php.net/manual/en/pdo.prepared-statements.php

PDO Object functions and properties: http://es1.php.net/manual/en/class.pdo.php

PDOStatement Object: http://es1.php.net/manual/en/class.pdostatement.php

Link to comment
Share on other sites

what's the problem you are facing with converting it? Have you tried anything yet? Have you reviewed the PDO docs?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...