Compare commits

..

3 Commits

Author SHA1 Message Date
6dffa09e88 add: insert into 2022-12-21 11:19:40 +01:00
a568d36eb2 Merge remote-tracking branch 'origin/don' into don
# Conflicts:
#	BancaDati/BancaDati.php
2022-12-21 11:10:40 +01:00
d8154b9d0f add: insert into 2022-12-21 11:09:49 +01:00

View File

@ -30,6 +30,32 @@ class BancaDati {
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
}
/**
* Einheitliche Insert Funktion
* @param string $table
* @param array $values
* @return void
* author Simon Bock
*/
public function insert(string $table, array $values){
$value = "";
$column = "";
foreach ($values as $col => $v){
$value .= $v . ",";
$column .= $col . ",";
}
$value = trim($value, ",");
$column = trim($column, ",");
$sql = "INSERT INTO $table($column) VALUES ($value);";
try {
$sth = $this->pdo->prepare($sql);
$sth->execute();
}catch (\PDOException $e){
die;
}
}
/**
* Einheitliche Update Funktion
* @param string $table