The following is my attempt at a prepare statement. It is causing the page to die at the moment so obviously something is wrong.
function telephoneinsert($elector,$inputs,$outputs){
global $dbh;
$sql = "UPDATE electors SET $inputs WHERE ID=?";
$q = $dbh->prepare($sql);
$q->execute(array($outputs,$elector));
//UPDATE STATS
}
That is the function called on page like this
telephoneinsert($Ielector,$inputs,$outputs);
Where $inputs = a posted array that if echoed looks like this name = ?, type =?. It is deliberately rtrim’d to get rid of the last comma.
Same principle with $outputs if echoed looks like benjamin,socialist
ERROR REPORTING SHOWING NOTHING
$this->pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );
print_r($dbh->errorInfo());
$outputscontains a comma-delimited string, butexecute()expects parameters to be passed as elements of an array. Therefore you must split the string apart: