-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearchcode.php
52 lines (38 loc) · 984 Bytes
/
searchcode.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
<?php
$db_hostname = 'localhost';
$db_username = 'root';
$db_password = '';
$db_database = 'shop';
// Database Connection String
$con = mysql_connect($db_hostname,$db_username,$db_password);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db($db_database, $con);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
<form action="" method="post">
Search: <input type="text" name="term" /><br />
<input type="submit" value="Submit" />
</form>
</head>
<body>
<?php
if (!empty($_REQUEST['term'])) {
$term = mysql_real_escape_string($_REQUEST['term']);
$sql = "SELECT * FROM code WHERE code LIKE '".$term."'";
$r_query = mysql_query($sql);
echo "<table border =1>";
while ($row = mysql_fetch_array($r_query)){
echo ' status: ' .$row['status'];
}
}
echo "<table>";
?>
</body>
</html>