Bugfixing

This commit is contained in:
color.diff=auto 2021-03-26 15:52:19 -06:00
parent 1fd9f2165a
commit 855a1a4ba6

View File

@ -51,28 +51,28 @@ class D2Database {
$sql = ''; $sql = '';
if (!empty($data)) { if (!empty($data)) {
foreach ($data as $d) { foreach ($data as $d) {
$sql = "INSERT INTO `$tableName` (";
if (!empty($d)) { if (!empty($d)) {
$sql = "INSERT INTO `$tableName` (";
foreach ($d as $k => $v) { foreach ($d as $k => $v) {
$sql .= "`$k`" . ","; $sql .= "`$k`" . ",";
} }
$sql = rtrim($sql, ",");
$sql .= ") ";
} }
$sql = rtrim($sql, ",");
$sql .= ") ";
} }
} }
$sql .= "VALUES "; $sql .= "VALUES ";
if (!empty($data)) { if (!empty($data)) {
foreach ($data as $d) { foreach ($data as $d) {
$sql .= "(";
if (!empty($d)) { if (!empty($d)) {
$sql .= "(";
foreach ($d as $k => $v) { foreach ($d as $k => $v) {
$sql .= '"' . $v . '"' . ","; $sql .= '"' . $v . '"' . ",";
} }
$sql = rtrim($sql, ",");
$sql .= "), ";
} }
$sql = rtrim($sql, ",");
$sql .= "), ";
} }
$sql = rtrim($sql, ", "); $sql = rtrim($sql, ", ");
PDO_Execute($sql); PDO_Execute($sql);