mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-10-13 16:34:23 -05:00
textarea line breaks, bootswatch, etc. I don't fucking remember
This commit is contained in:
@@ -33,38 +33,39 @@ if ($cmd == "getTable") {
|
||||
|
||||
// Iterate over the rows
|
||||
foreach ($rows as $row) {
|
||||
$tableMarkup .= '<tr class="row-' . $row['rowid'] . '">';
|
||||
$string = str_replace('\n', " ", $row['String']);
|
||||
|
||||
$tableMarkup .= "<tr class='row-{$row['rowid']}'>";
|
||||
|
||||
$tableMarkup .= "<td>{$row['rowid']}</td>";
|
||||
|
||||
// Display the Key column as a text input with Bootstrap form-control class
|
||||
$tableMarkup .= '<td><input type="text" value="' . $row['Key'] . '" class="form-control"></td>';
|
||||
$tableMarkup .= "<td><input type='text' value='{$row['Key']}' class='form-control'><span style='visibility: hidden;'>{$row['Key']}</span></td>";
|
||||
|
||||
// Display the String column as a textarea with Bootstrap form-control class
|
||||
$tableMarkup .= '<td><textarea class="form-control">' . $row['String'] . '</textarea></td>';
|
||||
$tableMarkup .= "<td><textarea class='form-control'>{$string}</textarea></td>";
|
||||
|
||||
// Add the Update and Delete links within a single td element
|
||||
$tableMarkup .= '<td><div>';
|
||||
$tableMarkup .= "<td><div>";
|
||||
|
||||
// Add the Update link with Bootstrap btn and btn-primary classes
|
||||
$tableMarkup .= '<a href="#" class="update-link btn btn-primary" data-rowid="' . $row['rowid'] . '">Update</a>';
|
||||
$tableMarkup .= "<a href='#' class='update-link btn btn-primary' data-rowid='{$row['rowid']}'>Update</a>";
|
||||
|
||||
// Add the Delete link with Bootstrap btn and btn-danger classes
|
||||
$tableMarkup .= '<a href="#" class="delete-link btn btn-danger" data-rowid="' . $row['rowid'] . '">Delete</a>';
|
||||
$tableMarkup .= "<a style='float:right' href='#' class='delete-link btn btn-danger' data-rowid='{$row['rowid']}'>Delete</a>";
|
||||
|
||||
$tableMarkup .= '</div></td>';
|
||||
$tableMarkup .= "</div></td>";
|
||||
|
||||
$tableMarkup .= '</tr>';
|
||||
$tableMarkup .= "</tr>";
|
||||
}
|
||||
|
||||
|
||||
// Return the table markup
|
||||
echo $tableMarkup;
|
||||
}
|
||||
|
||||
|
||||
if ($cmd == "update") {
|
||||
$query = "UPDATE patchstring SET Key = ?, String = ? WHERE ROWID = ?";
|
||||
$query = "UPDATE $tableName SET Key = ?, String = ? WHERE ROWID = ?";
|
||||
PDO_Execute($query, [$_REQUEST['key'], $_REQUEST['string'], $_REQUEST['rowid']]);
|
||||
|
||||
echo $_REQUEST['key'] . " updated";
|
||||
@@ -87,13 +88,10 @@ if ($cmd == "add") {
|
||||
|
||||
// Execute the insert statement
|
||||
$result = PDO_Execute($query, $params);
|
||||
|
||||
|
||||
|
||||
// Retrieve the last inserted rowid from the table
|
||||
$query = "SELECT last_insert_rowid() AS rowid";
|
||||
$result = PDO_FetchOne($query);
|
||||
|
||||
|
||||
|
||||
echo $result;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user