$field) { if (isset($field["privileges"]["select"])) { $columns[] = $key; } $rights += $field["privileges"]; } if (isset($rights["insert"])) { echo '
\n"; } if (!$columns) { echo "" . lang('Unable to select the table') . ($fields ? "" : ": " . $mysql->error) . ".
\n"; } else { $indexes = indexes($_GET["select"]); echo "\n"; echo "\n"; $result = $mysql->query("SELECT SQL_CALC_FOUND_ROWS " . implode(", ", array_map('idf_escape', $columns)) . " FROM " . idf_escape($_GET["select"]) . ($where ? " WHERE " . implode(" AND ", $where) : "") . ($order ? " ORDER BY " . implode(", ", $order) : "") . (strlen($limit) ? " LIMIT " . intval($limit) . " OFFSET " . ($limit * $_GET["page"]) : "")); if (!$result->num_rows) { echo " \n"; } else { $found_rows = $mysql->result($mysql->query(" SELECT FOUND_ROWS()"), 0); // space for mysql.trace_mode $foreign_keys = array(); foreach (foreign_keys($_GET["select"]) as $foreign_key) { foreach ($foreign_key[2] as $val) { $foreign_keys[$val][] = $foreign_key; } } $childs = array(); if ($mysql->server_info >= 5) { // would be possible in earlier versions too, but only by examining all tables (in all databases) $result1 = $mysql->query("SELECT * FROM information_schema.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_SCHEMA = '" . $mysql->real_escape_string($_GET["db"]) . "' AND REFERENCED_TABLE_NAME = '" . $mysql->real_escape_string($_GET["select"]) . "' ORDER BY ORDINAL_POSITION"); while ($row1 = $result1->fetch_assoc()) { $childs[$row1["CONSTRAINT_NAME"]][0] = $row1["TABLE_SCHEMA"]; $childs[$row1["CONSTRAINT_NAME"]][1] = $row1["TABLE_NAME"]; $childs[$row1["CONSTRAINT_NAME"]][2][] = $row1["REFERENCED_COLUMN_NAME"]; $childs[$row1["CONSTRAINT_NAME"]][3][] = $row1["COLUMN_NAME"]; } $result1->free(); } echo "" . implode(" | ", array_map('htmlspecialchars', array_keys($row))) . " | " . lang('Action') . " |
---|---|---|
' . lang('edit') . ''; foreach ($childs as $child) { echo ' ' . htmlspecialchars($child[1]) . ''; } echo ' | '; echo "
" . lang('Page') . ":\n"; for ($i=0; $i < $found_rows / $limit; $i++) { echo ($i == $_GET["page"] ? $i + 1 : '' . ($i + 1) . "") . "\n"; } echo "
\n"; } } $result->free(); }