Hello, please tell me how to properly implement the output of data from the Oracle database table in an html table with the ability to edit.

What did: workWithOralce.php

//Вывести данные одной таблицы public static function getDataTable($table){ $conn=oci_connect("login","passord","//localhost/orcl.lan"); if (!$conn) { $e = oci_error(); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } //Запрос наименовай столбцов $stid = oci_parse($conn, 'SELECT * from dba_tab_columns where table_name = ' . '\'' . $table . '\''); oci_execute($stid); //Запрос всех данных таблицы $stip = oci_parse($conn, 'SELECT * from ' . $table); oci_execute($stip); $items = array(); $items2 = array(); echo "<table class=\"table table-hover table-striped\" border=\"1\">\n"; while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) { $items[] = $row; } //Получаем нименования столбцов $arr = array(); foreach($items as $item){ array_push($arr, $item['COLUMN_NAME']); } //Удаляем повторяющиеся наименования $res = array_unique($arr); sort($res); $len = count($res); $arr2 = array(); $count = 0; //Содаем многомерный массив значений while ($row2 = oci_fetch_array($stip, OCI_ASSOC+OCI_RETURN_NULLS)) { //Генерация многомерного массива // Длинна массива зависит от длины $res for($n = 0; $n < $len; $n++){ $arr2[$count][$n] = $row2[$res[$n]]; } $count += 1; } //Выводим зоговлки таблицы echo "<table class=\"table table-hover table-condensed\" border='1'>\n"; echo '<tr>'; foreach ($res as $key) { echo '<th>' . $key . '</th>'; } echo '</tr>'; // Тело таблицы $len2 = count($arr2); for($b = 0; $b < $len2; $b++){ echo '<tr>'; foreach ($arr2[$b] as $value) { echo '<td>' . $value . '</td>'; } echo '</tr>'; } echo '</table>'; } 

The table is displayed correctly. But I don’t understand how to implement editing with subsequent saving.

  • Well, editing with saving html tables is already necessary to be implemented in javascript . You can search for plugins for this ready. For jQuery, there must be solutions. - Moonvvell
  • Send data to your script via ajax or sending an input form. And the script is already sending insert / update / delete requests to the database - Mike

0