Sunday, 25 August 2013

PHP PDO INSERT query failing

PHP PDO INSERT query failing

So i'm making this project, and one of the INSERT queries I'm using seems
to malfunction. I have other INSERT queries on the same project that do
work, so I'm not really sure what the problem is. This is the query that
malfunctions. Dumping the errors turns up nothing, but no rows are
affected.
$qry3 = $conn->prepare("INSERT INTO usermovie(user,movie) VALUES(:user,
:filmid)");
$qry3->bindParam(':user',$user,PDO::PARAM_STR,16);
$qry3->bindParam(':filmid',$film,PDO::PARAM_INT);
$qry3->execute(); //usermovie, user and movie are the
correct names for the table and columns.
For comparison, this insert query in the same project does work, and
creates a new entry.
$qry2 = $conn->prepare("INSERT INTO users(userid,userpass,email,credits)
VALUES(:username, :password, :email,0)");
$qry2->bindParam(':username', $nusername, PDO::PARAM_STR, 16);
$qry2->bindParam(':password', $npassword, PDO::PARAM_STR, 16);
$qry2->bindParam(':email', $nemail, PDO::PARAM_STR, 16);
$qry2->execute();

No comments:

Post a Comment