Ledenoverzicht in Tabel
Ik ben bezig met een pagina waarop alle ledengegevens staan van een Virtual Airlines. Ik wil deze gegevens mooi weergeven in een tabel. Er staan nu 3 test leden in de database en het script weergeeft ook mooi 3 tabellen, maar hij laat de gegevens niet zien. (nu alleen nog aan het begin van de tabel: $rij->pilootnummer) Hij laat dat gewoon als tekst zien, ik heb al vanalles geprobeerd maar het lukt me niet om het goed te doen. (note: ben pas begonnen met php ;D)
Kunnen jullie mij helpen?
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
include ("data.inc");
$global_dbh = mysql_connect($hostname, $username, $password);
mysql_select_db($db, $global_dbh);
$sql = "SELECT * FROM airbelgium";
$res = mysql_query($sql);
while ($rij = mysql_fetch_object($res))
{ echo'<table border="0" width="100%">
<tr>
<td colspan="4" bgcolor="#C0C0C0">
<p align="center">
<font face="Century Gothic" size="2">Member Pilot
ID: ABB $rij->pilootnummer</font></td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Pilot ID</font></td>
<td width="25%" bgcolor="#F8F8F8">
<font face="Century Gothic" size="2">ABB</font></td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Flight
Simulator</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Name</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">IVAO Member</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Sex</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">IVAO</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Date of Birth</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">VATSIM</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Country</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Globalsim</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">City</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">FPI</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Email</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="50%" bgcolor="#F8F8F8" colspan="2"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">MSN</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">ABB Admin</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">ICQ</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">ABB Admin ID</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="100%" bgcolor="#F8F8F8" colspan="4"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Flown Hours</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Previous VA
Name</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Rules Acception</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Previous VA
Pilot ID</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">User Comments</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Previous VA
Flown Hours</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF"> </td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Previous VA
Website</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="100%" bgcolor="#EFEFEF" colspan="4"> </td>
</tr>
<tr>
<td width="100%" bgcolor="#FFFFFF" colspan="4"> </td>
</tr>
<tr>
<td width="100%" bgcolor="#FFFFFF" colspan="4"> </td>
</tr>
<tr>
<td width="100%" bgcolor="#FFFFFF" colspan="4"> </td>
</tr>
</table>';}
?>
include ("data.inc");
$global_dbh = mysql_connect($hostname, $username, $password);
mysql_select_db($db, $global_dbh);
$sql = "SELECT * FROM airbelgium";
$res = mysql_query($sql);
while ($rij = mysql_fetch_object($res))
{ echo'<table border="0" width="100%">
<tr>
<td colspan="4" bgcolor="#C0C0C0">
<p align="center">
<font face="Century Gothic" size="2">Member Pilot
ID: ABB $rij->pilootnummer</font></td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Pilot ID</font></td>
<td width="25%" bgcolor="#F8F8F8">
<font face="Century Gothic" size="2">ABB</font></td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Flight
Simulator</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Name</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">IVAO Member</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Sex</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">IVAO</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Date of Birth</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">VATSIM</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Country</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Globalsim</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">City</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">FPI</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Email</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="50%" bgcolor="#F8F8F8" colspan="2"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">MSN</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">ABB Admin</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">ICQ</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">ABB Admin ID</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="100%" bgcolor="#F8F8F8" colspan="4"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Flown Hours</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Previous VA
Name</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Rules Acception</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Previous VA
Pilot ID</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">User Comments</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Previous VA
Flown Hours</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="25%" bgcolor="#EFEFEF"> </td>
<td width="25%" bgcolor="#F8F8F8"> </td>
<td width="25%" bgcolor="#EFEFEF">
<font face="Century Gothic" size="2">Previous VA
Website</font></td>
<td width="25%" bgcolor="#F8F8F8"> </td>
</tr>
<tr>
<td width="100%" bgcolor="#EFEFEF" colspan="4"> </td>
</tr>
<tr>
<td width="100%" bgcolor="#FFFFFF" colspan="4"> </td>
</tr>
<tr>
<td width="100%" bgcolor="#FFFFFF" colspan="4"> </td>
</tr>
<tr>
<td width="100%" bgcolor="#FFFFFF" colspan="4"> </td>
</tr>
</table>';}
?>
Voorbeeld:
$rij->pilootnummer
daar maken wij even van:
'.$rij->pilootnummer.'
Dat zou moeten werken. Veel succes er mee!
probeer eens: $rij['pilootnummer']; ipv: $rij->pilootnummer
Jelmer:
$rij->pilootnummer
daar maken wij even van:
'.$rij->pilootnummer.'
daar maken wij even van:
'.$rij->pilootnummer.'
Hey dat werkt!
Ikzelf had al eens geprobeerd ".$rij->pilootnummer." maar dat werkte niet, dus ik dacht dat het met ' ook niet zou werken, maar dus toch.
Hartstikke Bedankt!
(hier kan wat mij betrefd een slotje op)
Gewijzigd op 02/06/2005 21:34:00 door Ramon
Zim:
probeer eens: $rij['pilootnummer']; ipv: $rij->pilootnummer
Hij gebruikt toch echt fetch_object...
ff opgezocht op php.net, was verward met fetch_array! tanx