-
Notifications
You must be signed in to change notification settings - Fork 0
/
fetch.php
39 lines (37 loc) · 928 Bytes
/
fetch.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
<?php
$connect = mysqli_connect("localhost", "root", "", "dbfood");
$output = '';
if(isset($_POST["query"]))
{
$search = mysqli_real_escape_string($connect, $_POST["query"]);
$query = "
SELECT * FROM tblvendor
WHERE fld_name LIKE '%".$search."%'
OR fld_address LIKE '%".$search."%'
";
}
else
{
$query = "
SELECT * FROM tblvendor ";
}
$result = mysqli_query($connect, $query);
if(mysqli_num_rows($result) > 0)
{
$output .= '';
while($row = mysqli_fetch_array($result))
{
$vendor_id= $row['fldvendor_id'];
$output .= '
<tr style="width:300px;background:white; border:1px solid black;">
<td style="border-bottom:solid 1px black;padding:20px;"><a href="search.php?vendor_id='.$vendor_id.'" style="text-decoration:none;font-weight:bold; color:black;padding:100px;">'.$row["fld_name"].'</a></td>
</tr>
';
}
echo $output;
}
else
{
echo 'Data Not Found';
}
?>