-
Notifications
You must be signed in to change notification settings - Fork 0
/
searchtopicajax.php
37 lines (24 loc) · 961 Bytes
/
searchtopicajax.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
<?php
require_once('auth.php');
include("connection.php");
$term=$_POST['term'];
$kqry="SELECT topic_id,category FROM topic where category like '$term%' ORDER BY views DESC ";
$y=-1;
$p=0;
$kresult=mysql_query($kqry);
while($krow = mysql_fetch_row($kresult))
{$n = rand(3 , 7 );
if($p==0||$p==1)
{echo'<div class="col-lg-6 col-sm-6 cartoon "><a href="topic.php?tno='.$krow[0].'"><div class="well ttext c'.$n.'">'.$krow[1].'</div></a></div>';
$p++;
$y=0;}
else if($p==2||$p==3||$p==4)
{ echo'<div class="col-lg-4 col-sm-6 cartoon "><a href="topic.php?tno='.$krow[0].'"><div class="well ttext c'.$n.'">'.$krow[1].'</div></a></div>';
$p++;
$y=0;
if($p==5){$p=0;}
}
}
if(!$krow[1]&& $y==-1)
{echo'<img height="20%" width="20%"src="images/sorry.png"></img><br /><h2>Sorry no topic</h2>';}
?>