I am trying to create simple log-in function where I am using PHP and SQLite to make it work but every time I click log-in I get "Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in G:\wwwroot\login.php:3 Stack trace: #0 G:\wwwroot\login.php(3): PDO->__construct('sqlite:G:/wwwro...') #1 {main} thrown in G:\wwwroot\login.php on line 3" am I doing something wrong any advice will be GREAT :).
I have log-in code and saved it as index.php
<html>
<body>
<form action="login.php" method="POST">
<p>Username</p><input type ="text" name="user"/>
<p>password</p><input type="password" name="pass"/>
<br />
<input type="submit" value="login"/>
</form>
</body>
</html>
I have another php called login.php and will be activated when the user clicks login button
<?php
$dir = 'sqlite:G:/wwwroot/SQLite/user_information.db';
$dbh = new PDO($dir) or die ("cannot open");
$myusername = $_POST['user'];
$mypassword = $_POST['pass'];
$myusername = stripslashes($myusername);
$mypassword = stripslashes ($mypassword);
$query = "SELECT * FROM user_information WHERE username='$myusername' AND password='$mypassword'";
$result = mysql_query($query);
$count = mysql_num_rows($result);
if($count==1){
echo'worked';
}
?>
And at last I have user_information.db where I downloaded sqlite3 and using cmd program to create the database.
G:\wwwroot\SQLite>sqlite3 user_information.db
SQLite version 3.8.4.3 2014-04-03 16:53:12
Enter ".help" for usage hints.
sqlite> create table user_info(username varchar(20), password varchar(20));
sqlite> insert into user_info values('WESTKINz','password');
sqlite> insert into user_info values('LAME','123456');