mysql - PDO prepared statement with insertion in database -
please have quetion, have here:
$query = $db->prepare('update survey_content set '.$type.' = '.$type.'+1 id = '.$where); $query->execute();
i'm new pdo , don't know how create new query, need add record on database, ok this?
$query1 = $db->prepare('insert daily (selected) values (.$type.)'); $query1->execute();
use placeholder , fill value in execute
method
$query1 = $db->prepare("insert daily (selected) values (?)"); $query1->execute($selected_data);
or bind parameter seperately
$query1 = $db->prepare("insert daily (selected) values (:sel_dat)"); $query1->bindparam(":sel_dat",$selected_data); $query1->execute();
Comments
Post a Comment