Kan de pagina niet weergeven
Nu heb ik een script gemaakt, alleen hij geeft aan: "Kan de pagina niet weergeven.".
Dit is mijn script: (Als je nog andere scripts wilt zien, moet je het zeggen)
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
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
<?
include "config.php";
include "safe.php";
include "vars.php";
if (isset($_POST['kies_team'])) {
$LAND = intval($_POST['land']);
$TEAM = intval($_POST['team']);
$sql = "
UPDATE soccer
SET team='".$team[$LAND][$TEAM]."'
WHERE username='".$username."'";
$qry = mysql_query($sql) or die(mysql_error());
echo "Team succesfully changed.<br>";
}
?>
<table>
<form method='post' action='chooseteam.php'>
<tr>
<td>
Land:
</td>
<td>
<select name='land'>
<?
for($i = 0; $i < $aantalLanden; $i ++) {
if (intval($_POST['land']) == $i) {
?>
<option value='<?= $i ?>' selected><?= $land[$i] ?></option>
<?
}else{
?>
<option value='<?= $i ?>'><?= $land[$i] ?></option>
<?
}
}
?>
</select>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type='submit' value='Kies' name='kies_land' />
</td>
</tr>
</form>
<form method='post' action='chooseteam.php'>
<tr>
<td>
Team:
</td>
<td>
<select name='team'>
<?
$getal = intval($_POST['land']);
for($i = 0; $i < $aantalTeams[$getal]; $i ++) {
?>
<option value='<?= $i ?>'><?= $team[$getal][$i] ?></option>
<?
}
?>
</select>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type='submit' value='Verander!' name='kies_team' />
</td>
</tr>
</form>
</table>
include "config.php";
include "safe.php";
include "vars.php";
if (isset($_POST['kies_team'])) {
$LAND = intval($_POST['land']);
$TEAM = intval($_POST['team']);
$sql = "
UPDATE soccer
SET team='".$team[$LAND][$TEAM]."'
WHERE username='".$username."'";
$qry = mysql_query($sql) or die(mysql_error());
echo "Team succesfully changed.<br>";
}
?>
<table>
<form method='post' action='chooseteam.php'>
<tr>
<td>
Land:
</td>
<td>
<select name='land'>
<?
for($i = 0; $i < $aantalLanden; $i ++) {
if (intval($_POST['land']) == $i) {
?>
<option value='<?= $i ?>' selected><?= $land[$i] ?></option>
<?
}else{
?>
<option value='<?= $i ?>'><?= $land[$i] ?></option>
<?
}
}
?>
</select>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type='submit' value='Kies' name='kies_land' />
</td>
</tr>
</form>
<form method='post' action='chooseteam.php'>
<tr>
<td>
Team:
</td>
<td>
<select name='team'>
<?
$getal = intval($_POST['land']);
for($i = 0; $i < $aantalTeams[$getal]; $i ++) {
?>
<option value='<?= $i ?>'><?= $team[$getal][$i] ?></option>
<?
}
?>
</select>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type='submit' value='Verander!' name='kies_team' />
</td>
</tr>
</form>
</table>
Kan de pagina niet weergeven? Dat duidt op een verkeerde url ingave in je adresbalk. Overigens zou ik bovenstaand script i.p.v. de velden 'los' submitten met javascript werken.
@ Djemo: Kan de pagina niet weergeven betekend het volgende:
Meest waarschijnlijke oorzaken:
Aan deze website wordt gewerkt.
De website bevat een programmeerfout.
Edit: ik hoop dat $aantalLanden, $aantalTeams, $land, $team, etc. uit vars.php komen?
Gewijzigd op 01/01/1970 01:00:00 door Jesper Diovo
EDIT: Foutje.
Wordt de pagina ook niet per ongeluk geredirect in één van de geinclude files?
Gewijzigd op 01/01/1970 01:00:00 door Mark PHP
Edit: Oh ja, haal 'or die()' even uit je script. Lelijke, lompe, foute manier van foutafhandeling. Bah, bah, bah.
Gewijzigd op 01/01/1970 01:00:00 door Jesper Diovo
Wat probeer je hier in op te slaan? Het lijkt me een geneste $team. Maar of dat technnisch ook mogelijk is? Echo deze query eens.
Dat de query technisch lukt, wil overigens niet zeggen dat er ook iets is bijgewerkt. Dat is weer een heel ander verhaal, dat zul je moeten controleren met de functie mysql_affected_rows().
@ pqFrank: Ik heb alle landen opgeslagen in een array ($land) en alle teams opgeslagen in een 2-dimensionale array ($team).
Het gaat er ten eerste ff om, dat ie zegt: Kan de pagina niet weergeven.
Ik post mn vars.php wel even:
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
99
100
101
102
103
104
105
106
107
108
109
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
<?php
$land[0] = "Duitsland";
$land[1] = "Engeland";
$land[2] = "Frankrijk";
$land[3] = "Nederland";
$aantalLanden = sizeof($land);
//Duitsland
$team[0][0] = "Bayer Leverkusen";
$team[0][1] = "Bayern München";
$team[0][2] = "VFL Bochum";
$team[0][3] = "Borussia Dortmund";
$team[0][4] = "Bor.Mönchengladbach";
$team[0][5] = "Eintracht Frankfurt";
$team[0][6] = "SC Freiburg";
$team[0][7] = "Hamburger SV";
$team[0][8] = "Hannover '96";
$team[0][9] = "Hansa Rostock";
$team[0][10] = "Hertha BSC Berlin";
$team[0][11] = "FC Kaiserslautern";
$team[0][12] = "FC Köln";
$team[0][13] = "München 1860";
$team[0][14] = "Schalke 04";
$team[0][15] = "VFB Stuttgart";
$team[0][16] = "Werder Bremen";
$team[0][17] = "VFL Wolfsburg";
//Engeland
$team[1][0] = "Arsenal FC";
$team[1][1] = "Aston Villa FC";
$team[1][2] = "Birmingham City";
$team[1][3] = "Blackburn Rovers FC";
$team[1][4] = "Bolton Wanderers FC";
$team[1][5] = "Charlton Athletic";
$team[1][6] = "Chelsea FC";
$team[1][7] = "Crystal Palace";
$team[1][8] = "Everton FC";
$team[1][9] = "Fulham";
$team[1][10] = "Liverpool FC";
$team[1][11] = "Manchester City FC";
$team[1][12] = "Manchester United FC";
$team[1][13] = "Middlesbrough FC";
$team[1][14] = "Newcastle United FC";
$team[1][15] = "Norwich City FC";
$team[1][16] = "Southampton FC";
$team[1][17] = "Tottenham Hotspur FC";
$team[1][18] = "West Bromwich Albion FC";
//Frankrijk
$team[2][0] = "AC Ajaccio";
$team[2][1] = "AJ Auxerre";
$team[2][2] = "Bastia";
$team[2][3] = "Bordeaux";
$team[2][4] = "Caen";
$team[2][5] = "Lens";
$team[2][6] = "Lille";
$team[2][7] = "FC Metz";
$team[2][8] = "AS Monaco";
$team[2][9] = "FC Nantes";
$team[2][10] = "Nice";
$team[2][11] = "Olympique Lyon";
$team[2][12] = "Olympique Marseille";
$team[2][13] = "Paris Saint Germain";
$team[2][14] = "Saint Étienne";
$team[2][15] = "FC Sochaux";
$team[2][16] = "Stade Rennes";
$team[2][17] = "Strasbourg";
//Italie
$team[3][0] = "AC Milan";
$team[3][1] = "Atalanta Bergamo";
$team[3][2] = "FC Bologna";
$team[3][3] = "Brescia Calcio";
$team[3][4] = "Cagliari Calcio";
$team[3][5] = "Chievo Verona";
$team[3][6] = "Inter(nazionale)";
$team[3][7] = "Juventus";
$team[3][8] = "Lazio Roma";
$team[3][9] = "US Lecce";
$team[3][10] = "AS Livorno Calcio";
$team[3][11] = "FC Palermo";
$team[3][12] = "Reggina Calcio";
$team[3][13] = "AS Roma";
$team[3][14] = "UC Sampdoria";
$team[3][15] = "AC Siena";
$team[3][16] = "Udinese Calcio";
//Nederland
$team[4][0] = "Ajax";
$team[4][1] = "AZ";
$team[4][2] = "De Graafschap";
$team[4][3] = "Excelsior";
$team[4][4] = "FC Groningen";
$team[4][5] = "FC Twente";
$team[4][6] = "FC Utrecht";
$team[4][7] = "Feyenoord";
$team[4][8] = "Heracles Almelo";
$team[4][9] = "NAC Breda";
$team[4][10] = "NEC";
$team[4][11] = "PSV";
$team[4][12] = "Roda JC";
$team[4][13] = "sc Heerenveen";
$team[4][14] = "Sparta Rotterdam";
$team[4][15] = "Vitesse";
$team[4][16] = "VVV-Venlo";
$team[4][17] = "Willem II";
for($i = 0; $i < $aantalLanden; $i ++) {
$aantalTeams[$i] = sizeof($team[$i]);
}
?>
$land[0] = "Duitsland";
$land[1] = "Engeland";
$land[2] = "Frankrijk";
$land[3] = "Nederland";
$aantalLanden = sizeof($land);
//Duitsland
$team[0][0] = "Bayer Leverkusen";
$team[0][1] = "Bayern München";
$team[0][2] = "VFL Bochum";
$team[0][3] = "Borussia Dortmund";
$team[0][4] = "Bor.Mönchengladbach";
$team[0][5] = "Eintracht Frankfurt";
$team[0][6] = "SC Freiburg";
$team[0][7] = "Hamburger SV";
$team[0][8] = "Hannover '96";
$team[0][9] = "Hansa Rostock";
$team[0][10] = "Hertha BSC Berlin";
$team[0][11] = "FC Kaiserslautern";
$team[0][12] = "FC Köln";
$team[0][13] = "München 1860";
$team[0][14] = "Schalke 04";
$team[0][15] = "VFB Stuttgart";
$team[0][16] = "Werder Bremen";
$team[0][17] = "VFL Wolfsburg";
//Engeland
$team[1][0] = "Arsenal FC";
$team[1][1] = "Aston Villa FC";
$team[1][2] = "Birmingham City";
$team[1][3] = "Blackburn Rovers FC";
$team[1][4] = "Bolton Wanderers FC";
$team[1][5] = "Charlton Athletic";
$team[1][6] = "Chelsea FC";
$team[1][7] = "Crystal Palace";
$team[1][8] = "Everton FC";
$team[1][9] = "Fulham";
$team[1][10] = "Liverpool FC";
$team[1][11] = "Manchester City FC";
$team[1][12] = "Manchester United FC";
$team[1][13] = "Middlesbrough FC";
$team[1][14] = "Newcastle United FC";
$team[1][15] = "Norwich City FC";
$team[1][16] = "Southampton FC";
$team[1][17] = "Tottenham Hotspur FC";
$team[1][18] = "West Bromwich Albion FC";
//Frankrijk
$team[2][0] = "AC Ajaccio";
$team[2][1] = "AJ Auxerre";
$team[2][2] = "Bastia";
$team[2][3] = "Bordeaux";
$team[2][4] = "Caen";
$team[2][5] = "Lens";
$team[2][6] = "Lille";
$team[2][7] = "FC Metz";
$team[2][8] = "AS Monaco";
$team[2][9] = "FC Nantes";
$team[2][10] = "Nice";
$team[2][11] = "Olympique Lyon";
$team[2][12] = "Olympique Marseille";
$team[2][13] = "Paris Saint Germain";
$team[2][14] = "Saint Étienne";
$team[2][15] = "FC Sochaux";
$team[2][16] = "Stade Rennes";
$team[2][17] = "Strasbourg";
//Italie
$team[3][0] = "AC Milan";
$team[3][1] = "Atalanta Bergamo";
$team[3][2] = "FC Bologna";
$team[3][3] = "Brescia Calcio";
$team[3][4] = "Cagliari Calcio";
$team[3][5] = "Chievo Verona";
$team[3][6] = "Inter(nazionale)";
$team[3][7] = "Juventus";
$team[3][8] = "Lazio Roma";
$team[3][9] = "US Lecce";
$team[3][10] = "AS Livorno Calcio";
$team[3][11] = "FC Palermo";
$team[3][12] = "Reggina Calcio";
$team[3][13] = "AS Roma";
$team[3][14] = "UC Sampdoria";
$team[3][15] = "AC Siena";
$team[3][16] = "Udinese Calcio";
//Nederland
$team[4][0] = "Ajax";
$team[4][1] = "AZ";
$team[4][2] = "De Graafschap";
$team[4][3] = "Excelsior";
$team[4][4] = "FC Groningen";
$team[4][5] = "FC Twente";
$team[4][6] = "FC Utrecht";
$team[4][7] = "Feyenoord";
$team[4][8] = "Heracles Almelo";
$team[4][9] = "NAC Breda";
$team[4][10] = "NEC";
$team[4][11] = "PSV";
$team[4][12] = "Roda JC";
$team[4][13] = "sc Heerenveen";
$team[4][14] = "Sparta Rotterdam";
$team[4][15] = "Vitesse";
$team[4][16] = "VVV-Venlo";
$team[4][17] = "Willem II";
for($i = 0; $i < $aantalLanden; $i ++) {
$aantalTeams[$i] = sizeof($team[$i]);
}
?>
$land[1] = "Engeland";
$land[2] = "Frankrijk";
$land[3] = "Nederland";
Waarom gebruik je geen ISO-codes als key? Dat maakt de boel 100x duidelijker en je bent niet meer afhankelijk van de volgorde:
$land['de'] = "Duitsland";
$land['uk'] = "Engeland";
$land['fr'] = "Frankrijk";
$land['nl'] = "Nederland";
(controleer wel even of dit de juiste landcodes zijn, weet het niet 100% zeker)
Uiteraard moet je de rest van je code ook even aanpassen, maar dat stelt weinig voor.
Ik doe dat omdat ik de selects dan in een for-loop kan zetten, dus 0 eerst, dan 1, dan 2 etc.
Dat snap ik ook wel, maar dat kun je ook doen met indexen die 100x duidelijker zijn. 0 zegt helemaal niks, 'de' zegt dat het wel eens over Duitsland zou kunnen gaan. Snappie?
Hoe zou je dat dan met indexen kunnen doen? Kan dat op precies dezelfde manier?
Zie mijn voorbeeldje, daar staat het toch?
Ik bedoel hoe zou je het met zo'n for-loop met indexen kunnen doen?
EDIT:
Misschien handig om er bij te vertellen, hij zegt:
HTTP-fout 500 - Interne serverfout
Gewijzigd op 01/01/1970 01:00:00 door jorian
jorian schreef op 06.03.2008 14:37:
Dat heeft toch niks met je script te maken? Dat klinkt mij in de oren als een 404-melding, je roept blijkbaar een niet-bestaande pagina op.Oke, maar hij werkt nog niet. Hij blijft weergeven: Kan de pagina niet weergeven.
Lees mn vorige EDIT.