forked from jennyrudemo/lego-database
-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
66 lines (43 loc) · 1.7 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
56
57
58
59
60
61
62
63
64
65
66
<?php
//om sökrutan är tom sök inget
$sequered = mysqli_real_escape_string($link, $_GET["search"]);
$search = ' WHERE (sets.SetID LIKE "'.$sequered.'%" OR sets.Setname LIKE "%'.$sequered.'%") ';
if(isset($_GET["search"]))
{
echo "din sökning:".$_GET['search'];
//$test = "sets.SetID LIKE '%".$_GET["search"]."%'";//Vi vill söka på setID, men i start vill vi inte ha alla.
//$test_name="sets.Setname LIKE '%".$_GET["search"]."%'";
$limit = $_GET["limit"];
$order = mysqli_real_escape_string($link, $_GET["searchorder"]);
//Spara radiobuttons och söka antingen på setID eller setname
if ($_GET["searchorder"] == "sbname")
{
$order = "Setname, SetID";
setcookie("rbutton", "sbname" , time()+(60*60*24*30));
}
else
{
$order = "SetID, Setname";
setcookie("rbutton", "sbid" , time()+(60*60*24*30));
}
echo "rbutton = ".$_COOKIE['rbutton'];
if(!$limit = $_GET["limit"])
{
$limit = 15;
}
print "GET:". $_GET["searchorder"]. "end";
$result = mysqli_query($link, //I FROM behöver vi sets?
"SELECT sets.SetID, sets.Setname, images.ItemID, images.has_gif, images.has_jpg, images.has_largejpg, images.has_largegif
FROM sets, images
$search AND sets.SetID = images.ItemID AND images.ItemtypeID = 'S'
ORDER BY $order
LIMIT $limit" //Vi vill ha en offset här < så att man kan visa de andra satserna! Helst med hjälp av att klicka på en knapp elr något.
);
print "NEXT:". $_GET["next_page"];
print "GET:". $sequered;
print "GET:". $_GET["search"];
}
else{
echo "din sökning:".$_GET['search'];
}
?>