Bugfixing

This commit is contained in:
color.diff=auto 2021-03-26 15:44:33 -06:00
parent 358666c292
commit 1fd9f2165a
2 changed files with 34 additions and 28 deletions

View File

@ -17,6 +17,7 @@ if (file_exists("d2im.db")) {
$db->fillsTables($k, $v);
}
}
die();
// put in html redirect as backup, because
// for some odd reason windows gives
// an error on header() but linux does not.

View File

@ -29,6 +29,7 @@ class D2Database {
$tableName = basename($file);
$tableName = strtolower(substr($tableName, 0, -4));
$sql = "CREATE TABLE IF NOT EXISTS `$tableName` (";
if (!empty($data)) {
foreach ($data[0] as $k => $v) {
if (is_numeric($v)) {
$dataType = "INT";
@ -37,6 +38,7 @@ class D2Database {
}
$sql .= "`$k` $dataType NOT NULL,";
}
}
$sql = rtrim($sql, ",");
$sql .= ")";
$res = PDO_Execute($sql);
@ -47,6 +49,7 @@ class D2Database {
$tableName = strtolower(substr($tableName, 0, -4));
$sql = '';
if (!empty($data)) {
foreach ($data as $d) {
$sql = "INSERT INTO `$tableName` (";
if (!empty($d)) {
@ -57,9 +60,9 @@ class D2Database {
$sql = rtrim($sql, ",");
$sql .= ") ";
}
}
$sql .= "VALUES ";
if (!empty($data)) {
foreach ($data as $d) {
$sql .= "(";
@ -75,3 +78,5 @@ class D2Database {
PDO_Execute($sql);
}
}
}