Going from something like:
$sql_update='';
$binders='';
if(isset($_POST['name']) && $_POST['name']!=''){
$name=$_POST['name'];
$binders.=",$name";
$sql_update.="`name`=?";
}
...
if(isset($_POST['phone']) && $_POST['phone']!=''){
$phone=$_POST['phone'];
$binders.=",$phone";
$sql_update.="`phone`=?";
}
$binders = trim($binders, ',');
$sql_update = trim($sql_update, ',');
if ($sql_update!='' && $binders!='') {
$sql = "UPDATE ___table___
SET $sql_update
WHERE id=$___id___";
$q = $conn->prepare($sql);
// $q->execute(array($binders,$___id___));
}
How would you send it to the PDO function?
I spent the whole day trying to convert it from a mysql statement to a PDO statement, and feel like