add searching users, searching groups, remembering search options

This commit is contained in:
Hendrik
2017-01-20 16:18:09 +01:00
parent 0eb292d654
commit 9152ae4f75
5 changed files with 137 additions and 52 deletions

View File

@@ -1,7 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<?php include("../views/head.php"); ?>
<?php
include_once("../queries/user.php");
include_once("../queries/group_page.php");
include("../views/head.php");
?>
<style>
@import url("styles/search.css");
</style>

View File

@@ -10,3 +10,8 @@
#search-friends-output {
margin-right: 10px;
}
.searchleft, .searchright {
display: inline-block;
vertical-align: top;
}

View File

@@ -172,5 +172,26 @@ function changeMultipleGroupStatusByID($ids, $status) {
return $q;
}
function searchSomeGroups($n, $m, $search) {
$stmt = $GLOBALS["db"]->prepare("
SELECT
`name`,
`picture`
FROM
`group_page`
WHERE
`name` LIKE :keyword
ORDER BY
`name`
LIMIT
:n, :m
");
$search = "%$search%";
$stmt->bindParam(':keyword', $search);
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
$stmt->execute();
return $stmt;
}
?>

View File

@@ -272,3 +272,32 @@ function selectRandomNotFriendUser($userID) {
$stmt->execute();
return $stmt->fetch();
}
function searchSomeUsers($n, $m, $search) {
$stmt = $GLOBALS["db"]->prepare("
SELECT
`username`,
`profilepicture`,
`fname`,
`lname`
FROM
`user`
WHERE
`username` LIKE :keyword OR
`fname` LIKE :keyword OR
`lname` LIKE :keyword
ORDER BY
`fname`,
`lname`,
`username`
LIMIT
:n, :m
");
$search = "%$search%";
$stmt->bindParam(':keyword', $search);
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
$stmt->execute();
return $stmt;
}

File diff suppressed because one or more lines are too long