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

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -