-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.php
More file actions
201 lines (200 loc) · 3.85 KB
/
search.php
File metadata and controls
201 lines (200 loc) · 3.85 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<html>
<html>
<head>
<style>
table
{
text-align:center;
}
th
{
height:40px;
font-size:20px;
background-color:#F01467;
font-family:cambria;
text-align:center;
}
tr:hover td{
color:red;
}
td
{
width:20px;
height:50px;
font-family:cambria;
background-color:#ffffff;
text-align:center;
}
body
{
background-image:url('se.jpg');
}
</style>
</head>
<?php
$servername='localhost';
$username='root';
$password='';
$db='project';
$opt=$_POST['opt'];
$id=$_POST['id'];
$name=$_POST['name'];
$conn=mysqli_connect($servername,$username,$password,$db);
if(!$conn)
{
die('Could not connect:'.mysqli_error());
}
else
{
if($opt=='supplier')
{
$c=0;
if(!empty($name) && empty($id))
{
$sql="select id,name,company,date from supplier where name='$name';";
$res=mysqli_query($conn,$sql);
?>
<?php
while($row=mysqli_fetch_array($res))
{
?>
<body>
<table width="100%" height="10%">
<tr>
<td><a href><?php echo $row['id'];?></a></td>
<td><?php echo $row['name'];?></td>
<td><?php echo $row['company'];?></td>
<td><?php echo $row['date'];?></td>
</tr>
</table>
<?php
}
}
else if(!empty($id) && empty($name))
{
$sql="select id,name,company,date from supplier where id=$id;";
$res=mysqli_query($conn,$sql);
while($row=mysqli_fetch_array($res))
{
?>
<body>
<table width="100%" height="30%">
<tr>
<th>Id</th>
<th>Name</th>
<th>Company</th>
<th>Date</th>
</tr>
<tr>
<td><?php echo $row['id'];?></td>
<td><?php echo $row['name'];?></td>
<td><?php echo $row['company'];?></td>
<td><?php echo $row['date'];?></td>
</tr>
</table>
<?php
}
}
else if(!empty(id)&&!empty(name))
{
$sql="select id,name,company,date from supplier where name='$name' and id=$id;";
$res=mysqli_query($conn,$sql);
while($row=mysqli_fetch_array($res))
{
?>
<body>
<br>
<br><br><br><br>
<table align="center" width="100%" height="30%">
<tr>
<th>Id</th>
<th>Name</th>
<th>Company</th>
<th>Date</th>
</tr>
<tr>
<td><?php echo $row['id'];?></td>
<td><?php echo $row['name'];?></td>
<td><?php echo $row['company'];?></td>
<td><?php echo $row['date'];?></td>
</tr>
</table>
<?php
}
}
}
if($opt=='worker')
{
?>
<?php
$sql="select id,first,last,dob,job,email,mobile,gender,address,pincode,state,country from worker where id=$id;";
$res=mysqli_query($conn,$sql);
while($row=mysqli_fetch_array($res))
{
?>
<body>
<table width="100%" height="30%">
<tr>
<th>Id</th>
<th>First name</th>
<th>Last name</th>
<th>Date of birth</th>
<th>Date of join</th>
<th>Email</th>
<th>Mobile</th>
<th>Gender</th>
<th>Address</th>
<th>Pincode</th>
<th>State</th>
<th>Country</th>
</tr>
<tr>
<td><?php echo $row['id'];?></td>
<td><?php echo $row['first'];?></td>
<td><?php echo $row['last'];?></td>
<td><?php echo $row['dob'];?></td>
<td><?php echo $row['job'];?></td>
<td><?php echo $row['email'];?></td>
<td><?php echo $row['mobile'];?></td>
<td><?php echo $row['gender'];?></td>
<td><?php echo $row['address'];?></td>
<td><?php echo $row['pincode'];?></td>
<td><?php echo $row['state'];?></td>
<td><?php echo $row['country'];?></td>
</tr>
</table>
<?php
}
}
if($opt=='product')
{
$sql="select id,name,brand,sno,mrp,quantity from product where id=$id;";
$res=mysqli_query($conn,$sql);
while($row=mysqli_fetch_array($res))
{
?>
<body>
<table width="100%" height="30%">
<tr>
<th>Id</th>
<th>Name</th>
<th>Brand</th>
<th>Serial NO</th>
<th>MRP</th>
<th>Quantity</th>
</tr>
<tr>
<td><?php echo $row['id'];?></td>
<td><?php echo $row['name'];?></td>
<td><a href="https://en.wikipedia.org/wiki/<?php echo $row['brand'];?>"><?php echo $row['brand'];?></a></td>
<td><?php echo $row['sno'];?></td>
<td><?php echo $row['mrp'];?></td>
<td><?php echo $row['quantity'];?></td>
</tr>
</table>
<?php
}
}
}
?>
</html>