Probleempje met PHP => i.c.m. de query en while()
Ik heb een probleempje in PHP, icm MySQL.
Namelijk dit:
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
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
<?php
$query = "SELECT * FROM liveacars WHERE idpilot = `" . $id . "`";
$sqlquery = mysql_query($query, $con);
while ($rows = mysql_fetch_array($sqlquery)) {
imagestring($img, 3, 200, 50, $rows['FullName'] . " (" . $rows['IDPilot'] . ")", $color["White"]);
imagestring($img, 3, 200, 60, $rows['OriginAirport'] . " => " . $rows['DestinationAirport'], $color["White"]);
$status = "NONE";
switch ($rows['Status']) {
case 0:
$status = "Boarding";
break;
case 1:
$status = "Departing";
break;
case 2:
if ($rows['Altitude'] < 2000) {
$status = "Airborne";
break;
} elseif ($rows['Altitude'] > 2000) {
$status = "Climbing";
break;
} elseif ($rows['AltitudeStatus'] == 1) {
$status = "Cruising";
break;
} elseif ($rows['AltitudeStatus'] == 0) {
$status = "Descending";
break;
} elseif ($rows['Altitude'] < 10.000) {
$status = "Initial Approach";
break;
} elseif ($rows['Altitude'] < 2.500) {
$status = "Final Approach";
break;
}
break;
case 3:
$status = "Landed";
break;
case 4:
$status = "On Blocks";
break;
}
$eta = $rows['DistancePlanned'] - $rows['DistanceFlown'] / $rows['IAS'];
imagestring($img, 3, 200, 70, "Status: " . $status, $color["White"]);
imagestring($img, 3, 200, 80, "A/C Type: " . $rows['Aircraft'] . " / ZFW: " . $rows['ZFW'] . " kg's", $color["White"]);
imagestring($img, 3, 10, 125, "ALT: " . $rows['Altitude'] . " - SPD: " . $rows['IAS'] . " - ETA: " . $eta, $color["White"]);
}
?>
$query = "SELECT * FROM liveacars WHERE idpilot = `" . $id . "`";
$sqlquery = mysql_query($query, $con);
while ($rows = mysql_fetch_array($sqlquery)) {
imagestring($img, 3, 200, 50, $rows['FullName'] . " (" . $rows['IDPilot'] . ")", $color["White"]);
imagestring($img, 3, 200, 60, $rows['OriginAirport'] . " => " . $rows['DestinationAirport'], $color["White"]);
$status = "NONE";
switch ($rows['Status']) {
case 0:
$status = "Boarding";
break;
case 1:
$status = "Departing";
break;
case 2:
if ($rows['Altitude'] < 2000) {
$status = "Airborne";
break;
} elseif ($rows['Altitude'] > 2000) {
$status = "Climbing";
break;
} elseif ($rows['AltitudeStatus'] == 1) {
$status = "Cruising";
break;
} elseif ($rows['AltitudeStatus'] == 0) {
$status = "Descending";
break;
} elseif ($rows['Altitude'] < 10.000) {
$status = "Initial Approach";
break;
} elseif ($rows['Altitude'] < 2.500) {
$status = "Final Approach";
break;
}
break;
case 3:
$status = "Landed";
break;
case 4:
$status = "On Blocks";
break;
}
$eta = $rows['DistancePlanned'] - $rows['DistanceFlown'] / $rows['IAS'];
imagestring($img, 3, 200, 70, "Status: " . $status, $color["White"]);
imagestring($img, 3, 200, 80, "A/C Type: " . $rows['Aircraft'] . " / ZFW: " . $rows['ZFW'] . " kg's", $color["White"]);
imagestring($img, 3, 10, 125, "ALT: " . $rows['Altitude'] . " - SPD: " . $rows['IAS'] . " - ETA: " . $eta, $color["White"]);
}
?>
En bij While krijg ik de melding;
Parse error: syntax error, unexpected T_WHILE in /home/a6283833/public_html/members/sig/acars.php on line 31 (in dit geval lijn 5)
De script, boven de, in deze post zittende code, heb ik weggedaan.
Maar ook een klein stukje, onderkant.
Ik hoop dat iemand me kan helpen?!.
Alvast bedankt!.
Groet,
Brian
Gewijzigd op 05/01/2012 22:10:27 door Brian T
Alvast bedankt...
Ik denk zelf dat het probleem hogerop in de code zit.
Gewijzigd op 05/01/2012 21:44:57 door - Ariën -
WHERE idpilot = `" . $id . "`";
Inmiddels aangepast (In Adobe Dreamweaver) maar het probleem blijft bestaan.
En absoluut, in lijn 31/(5 in de code) dus de while($rows = mysql_fetch_array($query)).
Groet,
Brian
- Aar - op 05/01/2012 21:41:02:
Ik denk zelf dat het probleem hogerop in de code zit.
En werk die die() foutmeldingen weg. dit kan je veel netter afhandelen met if en else.
Gewijzigd op 05/01/2012 22:54:29 door - Ariën -
Opgelost!.
Bedankt!.
Groet,
Brian