rijen laten zien in 1 tabel
voorbeeld nu:
| header 1 | header 2 |
--------------------------
| waarde 1 | waarde 1|
| header 1 | header 2 |
--------------------------
| waarde 2 | waarde 2|
| header 1 | header 2 |
--------------------------
| waarde 3| waarde 3|
voorbeeld hoe het moet zijn:
| header 1 | header 2 |
--------------------------
| waarde 1 | waarde 1|
| waarde 2 | waarde 2|
| waarde 3 | waarde 3|
Waar gaat het fout?
Code?
Jacco schreef op 12.10.2007 11:55:
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
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
<table cellpadding="4" cellspacing="0" border="0" class="contentpane">
<thead>
<tr >
<th colspan="2">Naam</th>
<th>Bedrijf</th>
</tr>
</thead>
<tbody>
<tr>
<td width="40px" class=""sectiontableheader" >
<?php // Display User Details
echo $registrant->value;
//echo $registrant->comments . "<br clear=\"left\" /><br />";
?>
</td>
<td width="200px">
<?php // Display User Details
echo $registrant->fullname;
?>
</td width="200px">
<td>
<?php // Display User Details
echo $registrant->name;
?>
</td>
</tr>
<tbody>
</table>
<thead>
<tr >
<th colspan="2">Naam</th>
<th>Bedrijf</th>
</tr>
</thead>
<tbody>
<tr>
<td width="40px" class=""sectiontableheader" >
<?php // Display User Details
echo $registrant->value;
//echo $registrant->comments . "<br clear=\"left\" /><br />";
?>
</td>
<td width="200px">
<?php // Display User Details
echo $registrant->fullname;
?>
</td width="200px">
<td>
<?php // Display User Details
echo $registrant->name;
?>
</td>
</tr>
<tbody>
</table>
Gewijzigd op 01/01/1970 01:00:00 door raimond
Inclusief query en dergelijken
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
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
<?php
} // viewSession()
function displayRegistrations(&$row, $option, $customValues, $customFields) {
global $database, $mosConfig_live_site, $mosConfig_lang, $eSess;
/*
* Original Code from Michael Spredemann (scubaguy), which was based on
* Buddy Hack by Ford on http://www.mambojoe.com
* Revised by pcarr to conditionally deal with guests and community builder
*/
// query for people already registered
//$query = "SELECT * FROM #__events_registrations ";
//$query .= "WHERE session_id='".$row->session_id."' AND cancel_date='0000-00-00 00:00:00' ";
//$query .= "ORDER BY fullname ASC";
//$database->setQuery($query);
//$registrants = $database->loadObjectList();
$query = "SELECT reg.*, val.* FROM #__events_registrations AS reg"
. "\n INNER JOIN #__events_registration_fields_values AS val ON val.registration_id = reg.registration_id"
. "\n WHERE reg.session_id='".$row->session_id."' AND reg.cancel_date='0000-00-00 00:00:00' and field_id='18'";
$query .= "ORDER BY reg.fullname ASC";
$database->setQuery($query);
$registrants = $database->loadObjectList();
if (count($registrants) > 0) {
echo "<h3>" . _ESESS_REG_LIST . "</h3>";
foreach ($registrants as $registrant) {
if ($eSess["cbIntegrated"] && $eSess["showAvatar"]) {
// Load the avatar picture. For guests, display the appropriate no_picture file...
if ($registrant->userid) {
$query = "SELECT avatar FROM #__comprofiler WHERE user_id='".$registrant->userid."' AND avatarapproved=1";
$database->setQuery( $query );
$avatarFileName = $database->loadObjectList();
if ($avatarFileName[0]->avatar) {
/*
* Some photos may be from the gallery, while others may be user submitted
*/
if (strcmp("gallery", substr($avatarFileName[0]->avatar, 0, 7))) {
$avatarImgPath = $mosConfig_live_site . "/images/comprofiler/tn" . $avatarFileName[0]->avatar;
} else {
$avatarImgPath = $mosConfig_live_site . "/images/comprofiler/" . $avatarFileName[0]->avatar;
}
} else {
$avatarImgPath = $mosConfig_live_site . "/components/com_comprofiler/images/" . $mosConfig_lang . "/tnnophoto.jpg";
}
} else {
$avatarImgPath = $mosConfig_live_site . "/components/com_comprofiler/images/" . $mosConfig_lang . "/tnnophoto.jpg";
}
echo "<img src=\"" . $avatarImgPath . "\" alt=\"\" align=\"left\" />";
}
?>
<table cellpadding="4" cellspacing="0" border="0" class="contentpane">
<thead>
<tr >
<th colspan="2">Naam</th>
<th>Bedrijf</th>
</tr>
</thead>
<tbody>
<tr>
<td width="40px" class=""sectiontableheader" >
<?php // Display User Details
echo $registrant->value;
//echo $registrant->comments . "<br clear=\"left\" /><br />";
?>
</td>
<td width="200px">
<?php // Display User Details
echo $registrant->fullname;
?>
</td width="200px">
<td>
<?php // Display User Details
echo $registrant->name;
?>
</td>
</tr>
<tbody>
</table>
<?php
} //foreach ($registrants as $registrant)
} // if (count($registrants) > 0)
} // displayRegistrations
function displayRegistrationForm($option, &$registration, &$customFields, $customValues) {
global $eSess, $mosConfig_absolute_path;
?>
} // viewSession()
function displayRegistrations(&$row, $option, $customValues, $customFields) {
global $database, $mosConfig_live_site, $mosConfig_lang, $eSess;
/*
* Original Code from Michael Spredemann (scubaguy), which was based on
* Buddy Hack by Ford on http://www.mambojoe.com
* Revised by pcarr to conditionally deal with guests and community builder
*/
// query for people already registered
//$query = "SELECT * FROM #__events_registrations ";
//$query .= "WHERE session_id='".$row->session_id."' AND cancel_date='0000-00-00 00:00:00' ";
//$query .= "ORDER BY fullname ASC";
//$database->setQuery($query);
//$registrants = $database->loadObjectList();
$query = "SELECT reg.*, val.* FROM #__events_registrations AS reg"
. "\n INNER JOIN #__events_registration_fields_values AS val ON val.registration_id = reg.registration_id"
. "\n WHERE reg.session_id='".$row->session_id."' AND reg.cancel_date='0000-00-00 00:00:00' and field_id='18'";
$query .= "ORDER BY reg.fullname ASC";
$database->setQuery($query);
$registrants = $database->loadObjectList();
if (count($registrants) > 0) {
echo "<h3>" . _ESESS_REG_LIST . "</h3>";
foreach ($registrants as $registrant) {
if ($eSess["cbIntegrated"] && $eSess["showAvatar"]) {
// Load the avatar picture. For guests, display the appropriate no_picture file...
if ($registrant->userid) {
$query = "SELECT avatar FROM #__comprofiler WHERE user_id='".$registrant->userid."' AND avatarapproved=1";
$database->setQuery( $query );
$avatarFileName = $database->loadObjectList();
if ($avatarFileName[0]->avatar) {
/*
* Some photos may be from the gallery, while others may be user submitted
*/
if (strcmp("gallery", substr($avatarFileName[0]->avatar, 0, 7))) {
$avatarImgPath = $mosConfig_live_site . "/images/comprofiler/tn" . $avatarFileName[0]->avatar;
} else {
$avatarImgPath = $mosConfig_live_site . "/images/comprofiler/" . $avatarFileName[0]->avatar;
}
} else {
$avatarImgPath = $mosConfig_live_site . "/components/com_comprofiler/images/" . $mosConfig_lang . "/tnnophoto.jpg";
}
} else {
$avatarImgPath = $mosConfig_live_site . "/components/com_comprofiler/images/" . $mosConfig_lang . "/tnnophoto.jpg";
}
echo "<img src=\"" . $avatarImgPath . "\" alt=\"\" align=\"left\" />";
}
?>
<table cellpadding="4" cellspacing="0" border="0" class="contentpane">
<thead>
<tr >
<th colspan="2">Naam</th>
<th>Bedrijf</th>
</tr>
</thead>
<tbody>
<tr>
<td width="40px" class=""sectiontableheader" >
<?php // Display User Details
echo $registrant->value;
//echo $registrant->comments . "<br clear=\"left\" /><br />";
?>
</td>
<td width="200px">
<?php // Display User Details
echo $registrant->fullname;
?>
</td width="200px">
<td>
<?php // Display User Details
echo $registrant->name;
?>
</td>
</tr>
<tbody>
</table>
<?php
} //foreach ($registrants as $registrant)
} // if (count($registrants) > 0)
} // displayRegistrations
function displayRegistrationForm($option, &$registration, &$customFields, $customValues) {
global $eSess, $mosConfig_absolute_path;
?>
Dat is wat er in jouw code staat. Dan is het niet zo gek dat je diverse tabellen krijgt, of wel dan?
pgFrank schreef op 12.10.2007 12:11:
foreach resultaat, maak een tabel aan.
Dat is wat er in jouw code staat. Dan is het niet zo gek dat je diverse tabellen krijgt, of wel dan?
Dat is wat er in jouw code staat. Dan is het niet zo gek dat je diverse tabellen krijgt, of wel dan?
Allereerst bedankt voor je snelle reactie!
okay duidelijk.
Maar daarvoor in de plaats kan ik duys een "FOR" of "WHILE" gebruiken....en dan komen de foutmeldingen :-(
Wat jij wilt, is 1 tabel met een hele serie rijen. Het begin en einde van de tabel moet dus buiten de lus staan.
Succes!
volgorde veranderen van de table en het werkt!!
Nu nog een juiste query maken voor de insert, zodat alle kolommen goed gevuld worden.
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
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
<?php
} // viewSession()
function displayRegistrations(&$row, $option, $customValues, $customFields) {
global $database, $mosConfig_live_site, $mosConfig_lang, $eSess;
/*
* Original Code from Michael Spredemann (scubaguy), which was based on
* Buddy Hack by Ford on http://www.mambojoe.com
* Revised by pcarr to conditionally deal with guests and community builder
*/
// query for people already registered
//$query = "SELECT * FROM #__events_registrations ";
//$query .= "WHERE session_id='".$row->session_id."' AND cancel_date='0000-00-00 00:00:00' ";
//$query .= "ORDER BY fullname ASC";
//$database->setQuery($query);
//$registrants = $database->loadObjectList();
$query = "SELECT reg.*, val.* FROM #__events_registrations AS reg"
. "\n INNER JOIN #__events_registration_fields_values AS val ON val.registration_id = reg.registration_id"
. "\n WHERE reg.session_id='".$row->session_id."' AND reg.cancel_date='0000-00-00 00:00:00' and field_id='18'";
$query .= "ORDER BY reg.fullname ASC";
$database->setQuery($query);
$registrants = $database->loadObjectList();
if (count($registrants) > 0) {
echo "<h3>" . _ESESS_REG_LIST . "</h3>";
?>
<table cellpadding="4" cellspacing="0" border="0" class="contentpane">
<thead>
<tr >
<th colspan="2">Naam</th>
<th>Bedrijf</th>
</tr>
</thead>
<tbody>
<?php
foreach ($registrants as $registrant) {
if ($eSess["cbIntegrated"] && $eSess["showAvatar"]) {
// Load the avatar picture. For guests, display the appropriate no_picture file...
if ($registrant->userid) {
$query = "SELECT avatar FROM #__comprofiler WHERE user_id='".$registrant->userid."' AND avatarapproved=1";
$database->setQuery( $query );
$avatarFileName = $database->loadObjectList();
if ($avatarFileName[0]->avatar) {
/*
* Some photos may be from the gallery, while others may be user submitted
*/
if (strcmp("gallery", substr($avatarFileName[0]->avatar, 0, 7))) {
$avatarImgPath = $mosConfig_live_site . "/images/comprofiler/tn" . $avatarFileName[0]->avatar;
} else {
$avatarImgPath = $mosConfig_live_site . "/images/comprofiler/" . $avatarFileName[0]->avatar;
}
} else {
$avatarImgPath = $mosConfig_live_site . "/components/com_comprofiler/images/" . $mosConfig_lang . "/tnnophoto.jpg";
}
} else {
$avatarImgPath = $mosConfig_live_site . "/components/com_comprofiler/images/" . $mosConfig_lang . "/tnnophoto.jpg";
}
echo "<img src=\"" . $avatarImgPath . "\" alt=\"\" align=\"left\" />";
}
?>
<tr>
<td width="40px" align="left">
<?php // Display User Details
echo $registrant->value;
//echo $registrant->comments . "<br clear=\"left\" /><br />";
?>
</td>
<td width="200px" align="left">
<?php // Display User Details
echo $registrant->fullname;
?>
</td width="200px">
<td>
<?php // Display User Details
echo $registrant->name;
?>
</td>
</tr>
<?php
} //foreach ($registrants as $registrant)
} // if (count($registrants) > 0)
?>
</tbody>
</table>
<?php
} // displayRegistrations
function displayRegistrationForm($option, &$registration, &$customFields, $customValues) {
global $eSess, $mosConfig_absolute_path;
?>
} // viewSession()
function displayRegistrations(&$row, $option, $customValues, $customFields) {
global $database, $mosConfig_live_site, $mosConfig_lang, $eSess;
/*
* Original Code from Michael Spredemann (scubaguy), which was based on
* Buddy Hack by Ford on http://www.mambojoe.com
* Revised by pcarr to conditionally deal with guests and community builder
*/
// query for people already registered
//$query = "SELECT * FROM #__events_registrations ";
//$query .= "WHERE session_id='".$row->session_id."' AND cancel_date='0000-00-00 00:00:00' ";
//$query .= "ORDER BY fullname ASC";
//$database->setQuery($query);
//$registrants = $database->loadObjectList();
$query = "SELECT reg.*, val.* FROM #__events_registrations AS reg"
. "\n INNER JOIN #__events_registration_fields_values AS val ON val.registration_id = reg.registration_id"
. "\n WHERE reg.session_id='".$row->session_id."' AND reg.cancel_date='0000-00-00 00:00:00' and field_id='18'";
$query .= "ORDER BY reg.fullname ASC";
$database->setQuery($query);
$registrants = $database->loadObjectList();
if (count($registrants) > 0) {
echo "<h3>" . _ESESS_REG_LIST . "</h3>";
?>
<table cellpadding="4" cellspacing="0" border="0" class="contentpane">
<thead>
<tr >
<th colspan="2">Naam</th>
<th>Bedrijf</th>
</tr>
</thead>
<tbody>
<?php
foreach ($registrants as $registrant) {
if ($eSess["cbIntegrated"] && $eSess["showAvatar"]) {
// Load the avatar picture. For guests, display the appropriate no_picture file...
if ($registrant->userid) {
$query = "SELECT avatar FROM #__comprofiler WHERE user_id='".$registrant->userid."' AND avatarapproved=1";
$database->setQuery( $query );
$avatarFileName = $database->loadObjectList();
if ($avatarFileName[0]->avatar) {
/*
* Some photos may be from the gallery, while others may be user submitted
*/
if (strcmp("gallery", substr($avatarFileName[0]->avatar, 0, 7))) {
$avatarImgPath = $mosConfig_live_site . "/images/comprofiler/tn" . $avatarFileName[0]->avatar;
} else {
$avatarImgPath = $mosConfig_live_site . "/images/comprofiler/" . $avatarFileName[0]->avatar;
}
} else {
$avatarImgPath = $mosConfig_live_site . "/components/com_comprofiler/images/" . $mosConfig_lang . "/tnnophoto.jpg";
}
} else {
$avatarImgPath = $mosConfig_live_site . "/components/com_comprofiler/images/" . $mosConfig_lang . "/tnnophoto.jpg";
}
echo "<img src=\"" . $avatarImgPath . "\" alt=\"\" align=\"left\" />";
}
?>
<tr>
<td width="40px" align="left">
<?php // Display User Details
echo $registrant->value;
//echo $registrant->comments . "<br clear=\"left\" /><br />";
?>
</td>
<td width="200px" align="left">
<?php // Display User Details
echo $registrant->fullname;
?>
</td width="200px">
<td>
<?php // Display User Details
echo $registrant->name;
?>
</td>
</tr>
<?php
} //foreach ($registrants as $registrant)
} // if (count($registrants) > 0)
?>
</tbody>
</table>
<?php
} // displayRegistrations
function displayRegistrationForm($option, &$registration, &$customFields, $customValues) {
global $eSess, $mosConfig_absolute_path;
?>