function getColumnNames($table) { $table_col_count = getColumnCount($table); $names = array(); for ($i = 0; $i < $table_col_count; $i++) { $column_name = getColumnName($table, $i); array_push($names, $column_name); } return $names; pg_close($connection); }
<title>Connector do bazy GRM</title> <link rel="shortcut icon" href="http://grm.execon.pl/devel/images/favicons/favicon.ico"> <link rel="stylesheet" type="text/css" href="style.css"/> </head> <body> <?php require 'logic.php'; require 'tables_dict.php'; if (isset($_POST['sequence_step'])) { $sequence_step = $_POST['sequence_step']; } else { $sequence_step = 1; } $current_table = $tables_dict[$sequence_step]; $table_col_count = getColumnCount($current_table); $names = getColumnNames($current_table); $last_id = getNextId($current_table, $names[0]); $stored_id_map = array(); if (isset($_POST['iterator'])) { rebuildStoredIdMap(); } echo "\n\t\t\t<form action=\"connector.php\" method=\"post\">\n\t\t\t\t<table>"; for ($i = 0; $i < $table_col_count; $i++) { if ($i == 0) { $column_name = getColumnName($current_table, $i); $label = strval($column_name); $current_field = $i + 1; $stored_id_map[$column_name] = $last_id; echo "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>{$label}</td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<input type=\"text\" name=\"field_" . $i . "\" value=\"" . $last_id . "\" />\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"current_field\" value=\"" . $current_field . "\" />\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"current_table\" value=\"" . $current_table . "\" />\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"sequence_step\" value=\"" . $sequence_step . "\" />\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>"; } else {