-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathphpsearchtutorials.php
34 lines (33 loc) · 1.05 KB
/
phpsearchtutorials.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
<?php
require ('core.inc.php');
include 'connect.php';
if (loggedin()) {
include ('headerlogin.php');
}else {
include ('header.php');
}
if (isset($_GET['tut'])&&!empty($_GET['tut'])) {
$tut = mysqli_real_escape_string($link, $_GET['tut']);
$query = "SELECT * FROM phptuts WHERE title LIKE '%".$tut."%' ORDER BY id ASC";
$query_run = mysqli_query($link, $query);
@$count = mysqli_num_rows($query_run);
if ($count<1) {
echo '
<div class="container col-md-6 text-center">
<div class="alert alert-danger">
No results found for "<strong>'.$tut.'</strong>". Please try another keyword
</div></div>';
}
else {
echo '
<div class="container col-md-6 text-center">
<div class="alert alert-info">
'.$count .' results found for "<strong>'.$tut.'</strong>"
</div></div>';
}
while (@$row = mysqli_fetch_array($query_run)) {
echo '
<div class="col-md-6 text-center container"><h2 style="font-family: Georgia;"><a href="phpclassroom?tut='.$row['id'].'">'.$row['title'].'</a></div>';
}
}
?>