mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-17 04:45:16 +02:00
Merge pull request #10867 from annando/replace-p
replace "p" with higher level database functions
This commit is contained in:
commit
f05fecaec1
8 changed files with 34 additions and 85 deletions
|
@ -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'],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue