sqlite - Using prepared statements with SQLite3 and PHP -
i'm trying add data database using sqlite3 in php. got working without prepared statements i'm trying make safer. i'm not using pdo.
so far following code doesn't work. inserts words ":name" , ":email" database, instead of bound values should be:
$smt = $db->prepare("insert names (name, email) values (':name', ':email')"); $smt->bindvalue(':name', $var_name); $smt->bindvalue(':email', $var_email); $var_name = ($_post[post_name]); $var_email = ($_post[post_email]); $smt->execute();
so thought @ first because have single quotes around :name
, :email
in prepared statement. took out. when post form, puts blank entries database, doesn't insert values of $var_name
, $var_email
the statement is executing, it's not binding variables don't think. have done wrong?
you managed confuse binding functions completely.
it bindparam have used if don't have variable assigned yet.
while bindvalue have used existing value only.
also, desperately need have error reporting on
Comments
Post a Comment