From ec5b8ede42a7171f55b8668f07b0570ba3c513de Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 6 Jan 2021 12:51:10 +0100 Subject: minor optimize --- all.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'all.php') 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 +?> -- cgit