Jump to content
Sign in to follow this  
denndeal2007

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

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

 

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...