summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2021-01-06 12:51:10 +0100
committerRemi Collet <remi@remirepo.net>2021-01-06 12:51:10 +0100
commitec5b8ede42a7171f55b8668f07b0570ba3c513de (patch)
tree2a23f4632a8ed6c6630f37059cff9a581facdde3
parentb1ab0e6891f5ff0db6140a0846eb7d4c9af69f42 (diff)
minor optimize
-rw-r--r--all.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/all.php b/all.php
index 018f55e..6c408f0 100644
--- a/all.php
+++ b/all.php
@@ -63,12 +63,16 @@ function report ($db)
if (substr($what, 0, 1)=='%') {
+ $l = substr($what, 1, 1);
+ if (!ctype_alpha($l) && !ctype_digit($l)) {
+ $l = 'a';
+ }
$sql = sprintf(
"SELECT DISTINCT name
FROM rpm
- WHERE SUBSTRING(name,1,1) = %s
+ WHERE NAME LIKE '%s%%'
ORDER BY name",
- $db->quote(substr($what, 1, 1))
+ $l
);
} else {
$sql = sprintf(
@@ -243,4 +247,4 @@ $page_content = $smarty->fetch('all.tpl');
$smarty->assign('page_content', $page_content);
$smarty->display('main.tpl');
-?> \ No newline at end of file
+?>