]> git.ozlabs.org Git - ccan/blobdiff - web/searchengine.php
tdb: fix test to remove warning, and don't fail when tdb_check() barfs.
[ccan] / web / searchengine.php
index 6117f38b864cfbc6aa2198686ded1109ff5e865c..fdc5e9f8d0feea73958f0ea0c8732e4f89284990 100644 (file)
@@ -4,11 +4,14 @@ function searchdb($text, $in, $db)
        //search db 
        $handle = sqlite3_open($db) or die("Could not open database");
        if($in == 'module')
-               $query = "select * from search where title LIKE \"%$text%\"";
+               $query = "select * from search where title LIKE \"$text\" order by module,
+                                               author";
        else if($in == 'author')
-               $query = "select * from search where author LIKE \"%$text%\"";
+               $query = "select * from search where author LIKE \"$text\" order by module, 
+                                               author";
        else    
-               $query = "select * from search where title LIKE \"%$text%\" or author LIKE \"%$text%\"";
+               $query = "select * from search where title LIKE \"$text\" or author LIKE \"$text\" 
+                                               order by module, author";
                
        $result = sqlite3_query($handle, $query) or die("Error in query: ".sqlite3_error($handle));
        return $result;