getMessage(); } $cmd = $_REQUEST['cmd']; $tableName = $_REQUEST['tableName']; if ($cmd == "getTable") { $query = "SELECT ROWID,* FROM $tableName"; $rows = PDO_Execute($query); // Start the table with Bootstrap classes $tableMarkup = ''; // Iterate over the rows foreach ($rows as $row) { $tableMarkup .= ''; $tableMarkup .= "{$row['rowid']}"; // Display the Key column as a text input with Bootstrap form-control class $tableMarkup .= ''; // Display the String column as a textarea with Bootstrap form-control class $tableMarkup .= ''; // Add the Update and Delete links within a single td element $tableMarkup .= '
'; // Add the Update link with Bootstrap btn and btn-primary classes $tableMarkup .= 'Update'; // Add the Delete link with Bootstrap btn and btn-danger classes $tableMarkup .= 'Delete'; $tableMarkup .= '
'; $tableMarkup .= ''; } // Return the table markup echo $tableMarkup; } if ($cmd == "update") { $query = "UPDATE patchstring SET Key = ?, String = ? WHERE ROWID = ?"; PDO_Execute($query, [$_REQUEST['key'], $_REQUEST['string'], $_REQUEST['rowid']]); echo $_REQUEST['key'] . " updated"; } if ($cmd == "delete") { $query = "DELETE FROM $tableName WHERE ROWID = ?"; PDO_Execute($query, [$_REQUEST['rowid']]); echo $_REQUEST['rowid'] . " deleted"; } if ($cmd == "add") { $tableName = $_POST['tableName']; $key = $_POST['Key']; $string = $_POST['String']; // Create your insert statement using the provided values $query = "INSERT INTO $tableName (Key, String) VALUES (?, ?)"; $params = array($key, $string); // 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; }