PHP/MySQL Statements. How do I turn this into a prepared statement? -
$query = 'insert user_answer (facebook_id, answer_id) values (' . $i . ',' . $randanswer . ')'; $dbh->exec($query);
i have code, , required turn prepared statement using pdo::bindvalue() , maybe pdo::prepare(). looking @ examples, i'm not sure how go this. :name come , why putting in bindvalue part?
in case this:
$st = $dbh->prepare("insert user_answer (facebook_id, answer_id) values (:facebook_id, :answer_id)"); $st->execute(array('facebook_id' => $i, 'answer_id' => $randanswer));
you might want read a tutorial or 2 idea how use pdo effectively. pdo documentation pretty good.
the general idea here put in things :name
name value goes, , pass in array defines name
maps to.
Comments
Post a Comment