-
Notifications
You must be signed in to change notification settings - Fork 2
/
search.php
55 lines (47 loc) · 1.58 KB
/
search.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
<?php
$connection = mysql_connect("merabite.db.10424157.hostedresource.com","merabite","Ashwini@0529") or die(mysql_error());
$database = mysql_select_db('merabite') or die(mysql_error());
if($_POST)
{
$q=$_POST['search'];
$sql_res=mysql_query("select name,area,service,number from contacts where name like '%$q%' or area like '%$q%' LIMIT 5");
while($row=mysql_fetch_array($sql_res))
{
$username=$row['name'];
$area=$row['area'];
$service = $row['service'];
$number = $row['number'];
$b_username='<strong>'.$q.'</strong>';
$b_area='<strong>'.$q.'</strong>';
$b_service ='<strong>'.$q.'</strong>';
$b_number = '<strong>'.$q.'</strong>';
$final_username = str_ireplace($q, $b_username, $username);
$final_area = str_ireplace($q, $b_area, $area);
$final_service = str_ireplace($q, $b_service, $service);
$final_number = str_ireplace($q, $b_number, $number);
echo ' <div class="row">
<div class="col s12 m12 l12">
<div class="card white">
<div class="card-content black-text">
<span class="card-title">'.$final_username.'</span>
<p>Description: '.$final_service.'.</p>
<p>Area: '.$final_area.'</p>
</div>
<div class="card-action">
<a href="#">Contact: '.$final_number.'</a><br>
</div>
</div>
</div>
</div>';
?>
<!--div class="show" align="left">
<span class="name">< ?php echo $final_username; ?>
</span> <br/>< ?php echo $final_email; ?>
< ?php echo $final_service; ?>
</span> <br/>< ?php echo $final_number; ?>
<br/>
</div-->
<?php
}
}
?>