tabel om en om kleuren uit db

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Pagina: « vorige 1 2

Jan H

Jan H

15/09/2006 14:30:00
Quote Anchor link
Ik vrees dat je het niet helemaal begrijpt.
Dit is de volledige code:

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
<table style="font-size: 70%;">
<?php


            $sql
= "SELECT `RecordID`, `Naam`, `Jaar`, `Discipline`, `Prestatie` FROM tblRecords WHERE Type = '" . $obj->Type . "' AND Geslacht = '" . $obj->Geslacht . "' AND OI='Outdoor';";

                    if ($list = mysql_query($sql, $link)) {
                        $flip = 0;
                    while($record = mysql_fetch_object($list)) {
                        $flip ^= 1;
                    if($_SESSION['level'] == 1) {
                        $edit = "onclick=\"self.location.href='a_edit_clubrecord.php?id=" . $record->RecordID . "'\"";
                            }
else {
                        $edit = "";
                            }

                    if ($flip) {
                        $edit .= ' style="background: #fff"';
                            }

                            else {
                        $edit .= ' style="background: #eee"';
                            }

            ?>

    <tr onmouseover="this.style.backgroundColor='#afe890'" onmouseout="this.style.backgroundColor='#fff'"<?php echo $edit; ?>>
        <td style="width: 100px;"><?php echo htmlentities(stripslashes($record->Discipline)); ?></td>
        <td style="width: 350px;"><?php echo htmlentities(stripslashes($record->Naam)); ?></td>
        <td style="width: 50px;"><?php echo htmlentities(stripslashes(stripslashes($record->Prestatie))); ?></td>
        <td style="width: 50px;"><?php echo htmlentities(stripslashes($record->Jaar)); ?></td>
    </tr>
<?php
                }
            }

?>

</table>


Je ziet dus dat ik maar 1 keer de opmaak van de tabel staan heb, en dat hij automatisch de rijen om en om een andere kleur geeft.
Gewijzigd op 01/01/1970 01:00:00 door Jan H
 
PHP hulp

PHP hulp

15/05/2024 02:41:23
 
- SanThe -

- SanThe -

15/09/2006 14:52:00
Quote Anchor link
En zo?
Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
<?php


            $sql
= "SELECT `RecordID`, `Naam`, `Jaar`, `Discipline`, `Prestatie` FROM tblRecords WHERE Type = '" . $obj->Type . "' AND Geslacht = '" . $obj->Geslacht . "' AND OI='Outdoor';";

                    if ($list = mysql_query($sql, $link)) {
                        $flip = 0;
                    while($record = mysql_fetch_object($list)) {
                        $flip ^= 1;
                    if($_SESSION['level'] == 1) {
                        $edit = "onclick=\"self.location.href='a_edit_clubrecord.php?id=" . $record->RecordID . "'\"";
                            }
else {
                        $edit = "";
                            }

                    if ($flip) {
                        $edit .= " onmouseover=\"this.style.backgroundColor='#afe890'\" onmouseout=\"this.style.backgroundColor='#fff'\" style=\"background: #fff\"";
                            }

                            else {
                        $edit .= " onmouseover=\"this.style.backgroundColor='#afe890'\" onmouseout=\"this.style.backgroundColor='#eee'\" style=\"background: #eee\"";
                            }

            ?>

    <tr<?php echo $edit; ?>>
        <td style="width: 100px;"><?php echo htmlentities(stripslashes($record->Discipline)); ?></td>
        <td style="width: 350px;"><?php echo htmlentities(stripslashes($record->Naam)); ?></td>
        <td style="width: 50px;"><?php echo htmlentities(stripslashes(stripslashes($record->Prestatie))); ?></td>
        <td style="width: 50px;"><?php echo htmlentities(stripslashes($record->Jaar)); ?></td>
    </tr>
<?php
                }
            }

?>


Edit: Code tags toegevoegd.
Gewijzigd op 01/01/1970 01:00:00 door - SanThe -
 
Jan H

Jan H

15/09/2006 14:57:00
Quote Anchor link
Perfect!
 

Pagina: « vorige 1 2



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.