mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2024-11-30 12:36:03 +00:00
Bugfixing
This commit is contained in:
parent
358666c292
commit
1fd9f2165a
@ -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.
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user