1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-14 10:34:01 +02:00

Autocomplete for big foreign keys

This commit is contained in:
Jakub Vrana
2011-05-04 15:53:26 +02:00
parent daf85306a5
commit 6b4ee48ae8
7 changed files with 62 additions and 8 deletions

12
editor/script.inc.php Normal file
View File

@@ -0,0 +1,12 @@
<?php
if (list($table, $id, $name) = $adminer->_foreignColumn(column_foreign_keys($_GET["source"]), $_GET["field"])) {
$result = $connection->query("SELECT $id, $name FROM " . table($table) . " WHERE $name LIKE " . q("$_GET[value]%") . " ORDER BY 2 LIMIT 11");
for ($i=0; $i < 10 && ($row = $result->fetch_row()); $i++) {
echo "<a href='" . h(ME . "edit=" . urlencode($table) . "&where" . urlencode("[" . bracket_escape(idf_unescape($id)) . "]") . "=" . urlencode($row[0])) . "'>" . h($row[1]) . "</a><br>\n";
}
if ($i == 10) {
echo "...\n";
}
}
exit; // don't print footer