X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fmsearch.php;h=969446ffb524968f77f0acf1afd2528832abf23a;hb=d32f8e5285e6bb2265398fd658a39d3a6b5ff94e;hp=1e858f1db473504d7ba0ba86f26a40dad46fbe03;hpb=10038bb5782ff1ddbab39529dd8ebd54df4f774e;p=friendica.git diff --git a/mod/msearch.php b/mod/msearch.php index 1e858f1db4..969446ffb5 100644 --- a/mod/msearch.php +++ b/mod/msearch.php @@ -43,33 +43,10 @@ function msearch_post(App $a) $total = 0; - $count_stmt = DBA::p( - "SELECT COUNT(*) AS `total` - FROM `profile` - JOIN `user` ON `user`.`uid` = `profile`.`uid` - WHERE `profile`.`net-publish` - AND MATCH(`pub_keywords`) AGAINST (?)", - $search - ); - if (DBA::isResult($count_stmt)) { - $row = DBA::fetch($count_stmt); - $total = $row['total']; - } - - DBA::close($count_stmt); - - $search_stmt = DBA::p( - "SELECT `pub_keywords`, `username`, `nickname`, `user`.`uid` - FROM `user` - JOIN `profile` ON `user`.`uid` = `profile`.`uid` - WHERE `profile`.`net-publish` - AND MATCH(`pub_keywords`) AGAINST (?) - LIMIT ?, ?", - $search, - $startrec, - $perpage - ); + $condition = ["`net-publish` AND MATCH(`pub_keywords`) AGAINST (?)", $search]; + $total = DBA::count('owner-view', $condition); + $search_stmt = DBA::select('owner-view', ['pub_keywords', 'name', 'nickname', 'uid'], $condition, ['limit' => [$startrec, $perpage]]); while ($search_result = DBA::fetch($search_stmt)) { $results[] = [ 'name' => $search_result['name'],