Update
This commit is contained in:
@@ -30,11 +30,17 @@ class MySQL implements IDB
|
|||||||
}
|
}
|
||||||
|
|
||||||
function insert(string $table, array $data): bool {
|
function insert(string $table, array $data): bool {
|
||||||
$query = "INSERT INTO `".$table."` VALUES (";
|
$keys = "(";
|
||||||
for($i = 0; $i < sizeof($data); $i++) {
|
$values = "(";
|
||||||
$query .= "'".$data[$i]."', ";
|
foreach(array_keys($data) as $key) {
|
||||||
|
$keys .= "'".$key."', ";
|
||||||
}
|
}
|
||||||
$query .= ")";
|
foreach($data as $row) {
|
||||||
|
$values .= "'".$row."', ";
|
||||||
|
}
|
||||||
|
$keys .= ")";
|
||||||
|
$values .= ")";
|
||||||
|
$query = "INSERT INTO `".$table."` ".$keys." VALUES ".$values;
|
||||||
$result = mysqli_query($this->db, $query);
|
$result = mysqli_query($this->db, $query);
|
||||||
return $result ? true : false;
|
return $result ? true : false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user