fix: insert vales with single quotes
This commit is contained in:
parent
95a2c3e3fe
commit
23cf1b54e4
@ -44,17 +44,19 @@ class BancaDati {
|
||||
$value = "";
|
||||
$column = "";
|
||||
foreach ($values as $col => $v){
|
||||
$value .= $v . ",";
|
||||
$value .= "'" . $v . "'" . ",";
|
||||
$column .= $col . ",";
|
||||
}
|
||||
$value = trim($value, ",");
|
||||
$column = trim($column, ",");
|
||||
|
||||
$sql = "INSERT INTO $table ($column) VALUES ($value);";
|
||||
var_dump($sql);
|
||||
try {
|
||||
$sth = $this->pdo->prepare($sql);
|
||||
$sth->execute();
|
||||
}catch (PDOException $e){
|
||||
var_dump($e);
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user