Salve, è da poco che sto studiando il php ad oggetti e stavo provando ad inserire dati attraverso una funziona ma non mi funziona, ringrazio chiunque mi risponda in anticipo.

ho creato una class e poi questa funzione

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($query0, -2);
        return 
$this->ExecuteSQL($query);    } 
La richiamo in questo modo portando i dati da una form

Codice PHP:



<?phprequire 'mysql.php';
$moduli= new MySQL;$table ="finanziamento";$moduli->Insert($_POST$table);
?>
Dove sbaglio?
grazie a tutti