forked from jennyrudemo/lego-database
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index_tillsearch.php
117 lines (72 loc) · 2.09 KB
/
index_tillsearch.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
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
<!doctype html>
<html lang="ca">
<head>
<meta charset="utf-8">
<title>Grupp1 Lego</title>
<link href="style.css" media="screen" rel="stylesheet" />
</head>
<body>
<form action ="index.php" method="GET">
<p>Search <input type="text" name="search"/></p>
<p><input type="submit"/></p>
</form>
<table>
<tr>
<th>Quantity</th>
<th>File name</th>
<th>Color</th>
<th>Image</th>
<th>Part name</th>
</tr>
<?php
$link = mysqli_connect("mysql.itn.liu.se" ,"lego","", "lego");
if (!$link) {
echo "Error: Unable to connect to MySQL." . PHP_EOL;
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
exit;
}
echo "Success: A proper connection to MySQL was made! The my_db database is great." . PHP_EOL;
echo "Host information: " . mysqli_get_host_info($link) . PHP_EOL;
include "search.php";
//Koppla upp <li> blog.php?order=asc;<li> blog.php?order=desc&limit=10 colors.Colorname LIKE "%'.$_GET["search"].'%" OR Setname LIKE "%'.$_GET["search"].'%" ;
//Search keyword thingy:
//Skriv ut alla poster
while($row = mysqli_fetch_array($result)) {
$ItemID = $row["ItemID"];
$ItemtypeID = $row["ItemtypeID"];
$ColorID = $row["ColorID"];
$Quantity = $row["Quantity"];
$image= "http://www.itn.liu.se/~stegu76/img.bricklink.com";
$Partname = $row["Partname"];
$Colorname = $row["Colorname"];
print("<tr><td>$Quantity</td>");
if($row["has_jpg"])
{
$typ = ".jpg";
}
else if($row["has_gif"])
{
$typ = ".gif";
}
else if($row["has_largejpg"])
{
$typ = ".jpg";
}
else if($row["has_largegif"])
{
$typ = ".gif";
}
else{$typ = ".nope";}
$filename = "/".$ItemtypeID."/".$ColorID."/".$ItemID.$typ;
print("<td>$filename</td> ");
print("<td>$Colorname</td>");
print("<td> <img src=\"$image$filename\"></td>");
print("<td>$Partname</td> </tr>");
}
mysqli_close($link);
?>
</tr>
</table>
</body>
</html>