1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-16 03:24:01 +02:00

Respect numbers in autocomplete

This commit is contained in:
Jakub Vrana
2011-05-05 07:46:36 +02:00
parent dd295df9bd
commit 24e66c2812
3 changed files with 9 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
<?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");
$result = $connection->query("SELECT $id, $name FROM " . table($table) . " WHERE " . (ereg('^[0-9]+$', $_GET["value"]) ? "$id = $_GET[value] OR " : "") . "$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";
}