Scusa hai perfettamente ragione, rimetto lo script meglio formattato. Intanto ti dico che non mi da errori , ma non inserisce i dati nel database, il codice è:
:Codice PHP:
function Insert($vars, $table, $exclude = ''){
// Catch Exclusions
if($exclude == ''){
$exclude = array();
}
array_push($exclude, 'MAX_FILE_SIZE'); // Automatically exclude this one
// Prepare Variables
$vars = $this->SecureData($vars);
$query = "INSERT INTO `{$table}` SET ";
foreach($vars as $key=>$value){
if(in_array($key, $exclude)){ continue; }
//$query .= '`' . $key . '` = "' . $value . '", ';
$query .= "`{$key}` = '{$value}', "; }
$query = substr($query, 0, -2);
return $this->ExecuteSQL($query); }
e la pagina che riceve i dati ho fatto così:
<?phprequire 'mysql.php';
$moduli= new MySQL;
$table ="finanziamento";
$moduli->Insert($_POST, $table);
// post dovrebbe prendere tutti i dati che gli arrivano dal post se non erro
?>

Rispondi quotando