diff options
author | Remi Collet <remi@remirepo.net> | 2021-01-06 12:51:10 +0100 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2021-01-06 12:51:10 +0100 |
commit | ec5b8ede42a7171f55b8668f07b0570ba3c513de (patch) | |
tree | 2a23f4632a8ed6c6630f37059cff9a581facdde3 | |
parent | b1ab0e6891f5ff0db6140a0846eb7d4c9af69f42 (diff) |
minor optimize
-rw-r--r-- | all.php | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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 +?> |