MySQL en PHP werkt niet, Wit Pagina
Maar ik wil dan dat als je op de plaatje drukt van de stad (een plattegrond met de stad erin) dat hij dan naar reizen.php?p=pallettown (voorbeeld)
gaat en dan iets gaat aanpassen in de MySQL bij de leden van 't spel, maar volgens mij kan dat wel.. maar ik heb waarschijnlijk iets gecombineerd wat niet kan ofzo.. Zie script. Maar ik heb niet veel ervaring met PHP, maar wel een beetje.
Mijn bedoeling was: Al drukken ze op een stad van de plattegrond, dan gaat het linken naar bijv. reizen.php?p=pallettown en dat gaat er iets aangepast worden in de MySQL (Ticket gaat eraf en dan de cijfer van de stad komt in de MySQL opgeslagen) en dan "ben je bij" Pallet Town. Hopelijk snappen jullie wat ik bedoel en check de PHP file, en misschien kunnen jullie zeggen wat er aangepast kan worden!
Maar ik weet niet zeker of dit een goede script is: (het bestaat uit HERHALINGEN!)
Code (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
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
<?
else if($_GET['p'] == "pallettown") {
print " <tr><td class=\"subTitle\"><b>Station</b></td></tr>\n";
mysql_query("UPDATE `[users]` SET `Citynumb`='1' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `Ticket`=`Ticket`-1 WHERE `login`='{$member->login}'");
print " <tr><td class=\"mainTxt\">Je bent nu in Pallet Town!</td></tr>\n";
}
?>
<?
else if($_GET['p'] == "viridiancity") {
print " <tr><td class=\"subTitle\"><b>Station</b></td></tr>\n";
mysql_query("UPDATE `[users]` SET `Citynumb`='2' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `Ticket`=`Ticket`-1 WHERE `login`='{$member->login}'");
print " <tr><td class=\"mainTxt\">Je bent nu in Viridian City!</td></tr>\n";
}
?>
<?
else if($_GET['p'] == "pewtercity") {
print " <tr><td class=\"subTitle\"><b>Station</b></td></tr>\n";
mysql_query("UPDATE `[users]` SET `Citynumb`='3' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `Ticket`=`Ticket`-1 WHERE `login`='{$member->login}'");
print " <tr><td class=\"mainTxt\">Je bent nu in Pewter City!</td></tr>\n";
}
?>
<?
else if($_GET['p'] == "ceruleancity") {
print " <tr><td class=\"subTitle\"><b>Station</b></td></tr>\n";
mysql_query("UPDATE `[users]` SET `Citynumb`='4' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `Ticket`=`Ticket`-1 WHERE `login`='{$member->login}'");
print " <tr><td class=\"mainTxt\">Je bent nu in Cerulean City!</td></tr>\n";
}
?>
<?
else if($_GET['p'] == "saffroncity") {
print " <tr><td class=\"subTitle\"><b>Station</b></td></tr>\n";
mysql_query("UPDATE `[users]` SET `Citynumb`='5' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `Ticket`=`Ticket`-1 WHERE `login`='{$member->login}'");
print " <tr><td class=\"mainTxt\">Je bent nu in Saffron City!</td></tr>\n";
}
?>
<?
else if($_GET['p'] == "celadoncity") {
print " <tr><td class=\"subTitle\"><b>Station</b></td></tr>\n";
mysql_query("UPDATE `[users]` SET `Citynumb`='6' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `Ticket`=`Ticket`-1 WHERE `login`='{$member->login}'");
print " <tr><td class=\"mainTxt\">Je bent nu in Celadon City!</td></tr>\n";
}
?>
<?
else if($_GET['p'] == "lavendertown") {
print " <tr><td class=\"subTitle\"><b>Station</b></td></tr>\n";
mysql_query("UPDATE `[users]` SET `Citynumb`='7' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `Ticket`=`Ticket`-1 WHERE `login`='{$member->login}'");
print " <tr><td class=\"mainTxt\">Je bent nu in Lavender Town!</td></tr>\n";
}
?>
<?
else if($_GET['p'] == "vermilioncity") {
print " <tr><td class=\"subTitle\"><b>Station</b></td></tr>\n";
mysql_query("UPDATE `[users]` SET `Citynumb`='8' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `Ticket`=`Ticket`-1 WHERE `login`='{$member->login}'");
print " <tr><td class=\"mainTxt\">Je bent nu in Vermilion City!</td></tr>\n";
}
?>
<?
else if($_GET['p'] == "fuchsiacity") {
print " <tr><td class=\"subTitle\"><b>Station</b></td></tr>\n";
mysql_query("UPDATE `[users]` SET `Citynumb`='9' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `Ticket`=`Ticket`-1 WHERE `login`='{$member->login}'");
print " <tr><td class=\"mainTxt\">Je bent nu in Fuchsia City!</td></tr>\n";
}
?>
<?
else if($_GET['p'] == "cinnabarisland") {
print " <tr><td class=\"subTitle\"><b>Station</b></td></tr>\n";
mysql_query("UPDATE `[users]` SET `Citynumb`='10' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `Ticket`=`Ticket`-1 WHERE `login`='{$member->login}'");
print " <tr><td class=\"mainTxt\">Je bent nu in Cinnabar Island!</td></tr>\n";
}
?>
else if($_GET['p'] == "pallettown") {
print " <tr><td class=\"subTitle\"><b>Station</b></td></tr>\n";
mysql_query("UPDATE `[users]` SET `Citynumb`='1' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `Ticket`=`Ticket`-1 WHERE `login`='{$member->login}'");
print " <tr><td class=\"mainTxt\">Je bent nu in Pallet Town!</td></tr>\n";
}
?>
<?
else if($_GET['p'] == "viridiancity") {
print " <tr><td class=\"subTitle\"><b>Station</b></td></tr>\n";
mysql_query("UPDATE `[users]` SET `Citynumb`='2' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `Ticket`=`Ticket`-1 WHERE `login`='{$member->login}'");
print " <tr><td class=\"mainTxt\">Je bent nu in Viridian City!</td></tr>\n";
}
?>
<?
else if($_GET['p'] == "pewtercity") {
print " <tr><td class=\"subTitle\"><b>Station</b></td></tr>\n";
mysql_query("UPDATE `[users]` SET `Citynumb`='3' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `Ticket`=`Ticket`-1 WHERE `login`='{$member->login}'");
print " <tr><td class=\"mainTxt\">Je bent nu in Pewter City!</td></tr>\n";
}
?>
<?
else if($_GET['p'] == "ceruleancity") {
print " <tr><td class=\"subTitle\"><b>Station</b></td></tr>\n";
mysql_query("UPDATE `[users]` SET `Citynumb`='4' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `Ticket`=`Ticket`-1 WHERE `login`='{$member->login}'");
print " <tr><td class=\"mainTxt\">Je bent nu in Cerulean City!</td></tr>\n";
}
?>
<?
else if($_GET['p'] == "saffroncity") {
print " <tr><td class=\"subTitle\"><b>Station</b></td></tr>\n";
mysql_query("UPDATE `[users]` SET `Citynumb`='5' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `Ticket`=`Ticket`-1 WHERE `login`='{$member->login}'");
print " <tr><td class=\"mainTxt\">Je bent nu in Saffron City!</td></tr>\n";
}
?>
<?
else if($_GET['p'] == "celadoncity") {
print " <tr><td class=\"subTitle\"><b>Station</b></td></tr>\n";
mysql_query("UPDATE `[users]` SET `Citynumb`='6' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `Ticket`=`Ticket`-1 WHERE `login`='{$member->login}'");
print " <tr><td class=\"mainTxt\">Je bent nu in Celadon City!</td></tr>\n";
}
?>
<?
else if($_GET['p'] == "lavendertown") {
print " <tr><td class=\"subTitle\"><b>Station</b></td></tr>\n";
mysql_query("UPDATE `[users]` SET `Citynumb`='7' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `Ticket`=`Ticket`-1 WHERE `login`='{$member->login}'");
print " <tr><td class=\"mainTxt\">Je bent nu in Lavender Town!</td></tr>\n";
}
?>
<?
else if($_GET['p'] == "vermilioncity") {
print " <tr><td class=\"subTitle\"><b>Station</b></td></tr>\n";
mysql_query("UPDATE `[users]` SET `Citynumb`='8' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `Ticket`=`Ticket`-1 WHERE `login`='{$member->login}'");
print " <tr><td class=\"mainTxt\">Je bent nu in Vermilion City!</td></tr>\n";
}
?>
<?
else if($_GET['p'] == "fuchsiacity") {
print " <tr><td class=\"subTitle\"><b>Station</b></td></tr>\n";
mysql_query("UPDATE `[users]` SET `Citynumb`='9' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `Ticket`=`Ticket`-1 WHERE `login`='{$member->login}'");
print " <tr><td class=\"mainTxt\">Je bent nu in Fuchsia City!</td></tr>\n";
}
?>
<?
else if($_GET['p'] == "cinnabarisland") {
print " <tr><td class=\"subTitle\"><b>Station</b></td></tr>\n";
mysql_query("UPDATE `[users]` SET `Citynumb`='10' WHERE `login`='{$data->login}'");
mysql_query("UPDATE `[users]` SET `Ticket`=`Ticket`-1 WHERE `login`='{$member->login}'");
print " <tr><td class=\"mainTxt\">Je bent nu in Cinnabar Island!</td></tr>\n";
}
?>
En wat is nu de vraag?
dus wat is er fout aan die scripts?