X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=web%2Fsearch.php;h=d518d9f478963f57058a64c351cde9e4c85f576c;hp=d0c553303014134346bca0aa2377f0ad49fa126d;hb=ad8da11f6d0664e0fb3c8707a869425088daea7e;hpb=d2c982b37f3c4373e99e7c60c19d048de02b5919 diff --git a/web/search.php b/web/search.php index d0c55330..d518d9f4 100644 --- a/web/search.php +++ b/web/search.php @@ -12,16 +12,22 @@ if(isset($_POST['search'])) { if(trim($searchtext) == '') { echo '
Please enter some keyword to search
'; exit(); - } + } + $searchtext = '%'.$searchtext.'%'; } else if($_GET['author'] != '') { - $searchtext = $_GET['author']; + $searchtext = '%'.$_GET['author'].'%'; $in = "author"; } else if ($_GET['disp'] == 'all') { - $searchtext = ""; + $searchtext = "%"; + $in = "module"; +} +else if ($_GET['disp'] != '') { + $searchtext = $_GET['disp'].'%'; $in = "module"; } + else exit(); @@ -29,12 +35,14 @@ $result = searchdb($searchtext, $in, $db); echo ''; if($row = sqlite3_fetch_array($result)) echo ""; + "".$row["author"]." : ". $row["title"]. + "

"; else echo '
No results found
'; while($row = sqlite3_fetch_array($result)) { echo ""; + "".$row["author"]." : ". $row["title"]. + "

"; } echo '
".$row["module"]."
". - "".$row["author"]." : ". $row["title"]."

".$row["module"]."
". - "".$row["author"]." : ". $row["title"]."

'; ?>