The code that is causing the error:
public function Inserir($tabela,$sql){
ksort($sql);
$Campos_nome= implode('', '', array_keys($sql));
$Campos_valor= ': '. implode(', :', array_keys($sql));
$novo=$this->prepare("INSERT INTO $tabela ( '$Campos_nome')VALUES( $Campos_valor)");
print "INSERT INTO $tabela (' $Campos_nome')VALUES( $Campos_valor)";
foreach ($sql as $key => $valor) {
$novo->bindValue(":$key",$valor);
}
$novo->execute();
if($novo->rowCount()>0){
$novo->setFetchMode(PDO::FETCH_ASSOC);
$valor=$novo->fetchAll();
}
}
The error message you received:
Warning: PDOStatement :: execute (): SQLSTATE [HY093]: Invalid parameter number: number of bound variables does not match number of tokens in /home/sam/Dropbox/Portal1/libs/Database.php on line 39