-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
66 lines (64 loc) · 1.86 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
include('loadmore.php');
$search = "";
if(isset($_REQUEST["search_text"]))
{
if($_REQUEST["search_text"] != "")
{
$search = $_REQUEST["search_text"];
}
}
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<div class="container">
<br />
<form id="form" name="form" method="post">
<input type="text" name="search_text" value="<?php echo $search; ?>" id="search_text" placeholder="Search by firstname or lastname"/>
<input type="submit" id="button_seacrh" value="search" onclick="">
</form>
<br />
<div id="result"></div>
</div>
</body>
</html>
<ul class="news_list">
<?php
include('config.php');
$resultsPerPage=5;
$search = "";
if(isset($_REQUEST["search_text"]))
{
if($_REQUEST["search_text"] != "")
{
$search = $_REQUEST["search_text"];
$query = "SELECT * FROM users WHERE firstname LIKE '%$search%' OR lastname LIKE '%$search%' LIMIT 0 , $resultsPerPage";
}
else
{
$query = "SELECT * FROM users ORDER BY id LIMIT 0 , $resultsPerPage";
}
}
else
{
$query = "SELECT * FROM users ORDER BY id LIMIT 0 , $resultsPerPage";
}
$result = mysqli_query($connect, $query);
while($row=mysqli_fetch_array($result)){
echo '<div class="contain">';
echo $row['firstname']."<br>";
echo $row['lastname']."<br>";
echo $row['email']."<br>";
echo $row['gender']."<br>";
?><img src="<?php echo $row['picture'];?>" height='50' width='50'>
<?php echo "</div>";
}
?>
<li class="loadbutton"><button class="loadmore" data-page="2">Load More</button></li>
</ul>