Cannot insert into SQLite database through php PDO

Posted by user323941 on Stack Overflow See other posts from Stack Overflow or by user323941
Published on 2011-01-08T16:18:13Z Indexed on 2011/01/08 16:53 UTC
Read the original article Hit count: 138

Filed under:
|
|

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();}

?>

© Stack Overflow or respective owner

Related posts about php

Related posts about sqlite