Cannot insert into SQLite database through php PDO
- by user323941
Pls help see what is wrong.... (I test the db connection is fine)
<?php
$user_name=$_POST['user_name'];
$password=$_POST['password'];
$dbh=new PDO('sqlite:./db/user.db') or die("fail to connect db");
try{
 $stmt = $dbh->prepare("INSERT INTO user_info VALUES (?, ?)");
 $stmt->bindParam(1, $a);
 $stmt->bindParam(2, $b);
 $a=$user_name;
 $b=$password;
 $stmt->execute();
}
catch(PDOException $e) {echo $e->getMessage();}
?>