mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-10-13 16:34:23 -05:00
gendoc fixes, cube docs need fixing
This commit is contained in:
@@ -43,9 +43,6 @@ if ($result) {
|
||||
|
||||
|
||||
|
||||
// Define the path to the TSV file
|
||||
$tsvFilePath = $_SESSION['path'] . "/treasureclassex.txt";
|
||||
|
||||
// Open the file for writing
|
||||
$fileHandle = fopen($tsvFilePath, 'w');
|
||||
|
||||
@@ -56,22 +53,18 @@ $query = "SELECT * FROM treasureclassex";
|
||||
$result = $db->query($query);
|
||||
|
||||
// Write the column headers to the file
|
||||
$columnNames = $result->numColumns();
|
||||
$headers = [];
|
||||
for ($i = 0; $i < $columnNames; $i++) {
|
||||
$headers[] = $result->columnName($i);
|
||||
$columnNames = [];
|
||||
for ($i = 0; $i < $result->numColumns(); $i++) {
|
||||
$columnNames[] = $result->columnName($i);
|
||||
}
|
||||
fputcsv($fileHandle, $headers, "\t");
|
||||
fwrite($fileHandle, implode("\t", $columnNames) . "\n");
|
||||
|
||||
// Write the rows to the file
|
||||
while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
|
||||
fputcsv($fileHandle, $row, "\t");
|
||||
while ($row = $result->fetchArray(SQLITE3_NUM)) {
|
||||
fwrite($fileHandle, implode("\t", $row) . "\n");
|
||||
}
|
||||
|
||||
// Close the file
|
||||
fclose($fileHandle);
|
||||
|
||||
echo "Successfully updated and written to TSV file!";
|
||||
|
||||
// Close the database connection
|
||||
$db->close();
|
||||
echo "Successfully updated and written to TSV file!";
|
Reference in New Issue
Block a user