While werkt niet.
Ik zit met een probleem: mijn while-loop werkt niet. Ik heb al van alles geprobeerd, maar niets helpt, de while-loop bljft maar lopen, dus ontstaat er een time-out!
Dit is de code (let verder niet op de rest van de code):
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
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
<?php
echo '<meta HTTP-EQUIV="REFRESH" CONTENT="20">';
$day = date("w");
$hour = date("H");
$minute = date("i");
$second = date("s");
while ( $day == "2" ):
{
}
endwhile;
if (($day == 1) and ($hour == 00))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 01))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 02))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 03))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 04))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 05))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 06))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 07))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 08))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 09))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 10))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 11))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 12))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 13))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 14))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 15))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 17))
{ $link = "http://192.168.2.6:8000/listen.pls";
}
elseif (($day == 1) and ($hour == 16))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 18))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 19))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 20))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 21))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 22))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 23))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
else
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
?>
echo '<meta HTTP-EQUIV="REFRESH" CONTENT="20">';
$day = date("w");
$hour = date("H");
$minute = date("i");
$second = date("s");
while ( $day == "2" ):
{
}
endwhile;
if (($day == 1) and ($hour == 00))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 01))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 02))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 03))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 04))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 05))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 06))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 07))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 08))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 09))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 10))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 11))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 12))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 13))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 14))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 15))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 17))
{ $link = "http://192.168.2.6:8000/listen.pls";
}
elseif (($day == 1) and ($hour == 16))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 18))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 19))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 20))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 21))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 22))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
elseif (($day == 1) and ($hour == 23))
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
else
{ $link = "http://www.sky.fm/mp3/datempolounge.pls";
}
?>
Alvast bedankt,
Rogier.
Gewijzigd op 01/01/1970 01:00:00 door Rogier Nell
Je hebt een = maar het moet een == zijn.
Sorry, ja het is ==, maar het blijft niet werken.
als je je while direct weer sluit wat heb je er dan aan?
Jan Koehoorn schreef op 11.08.2009 14:28:
Kan ik ook een if-constructie gebruiken in mijn while-loop?
Rogier Nell schreef op 11.08.2009 14:31:
Kan ik ook een if-constructie gebruiken in mijn while-loop?
Jazeker. Maar als ik al jouw "if else's" bekijk, dan kun je beter een switch gebruiken.
Code (php)
Lees anders even de PHP beginners tutorial op deze site.
Gewijzigd op 01/01/1970 01:00:00 door Jan Koehoorn