Tabel

Gestart doorOne2xs10 reacties42 weergaven

11 berichten · pagina 1 van 1

One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Hoe zorg ik ervoor dat me query in 2 rijen gezet wordt?
voorbeeld:

<table>
<tr><td>Rij1</td><td>Rij2</td></tr>
<tr><td>Rij1</td><td>Rij2</td></tr>
<tr><td>Rij1</td><td>Rij2</td></tr>
<tr><td>Rij1</td><td>Rij2</td></tr>
<tr><td>Rij1</td><td>Rij2</td></tr>
etc.
</table>


en dit dan met 1 query
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Zo?

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<table>[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT ... FROM ... "[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$fetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700]))
{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<tr><td>[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]..[/COLOR][COLOR= #007700]] .[/COLOR] [COLOR= #DD0000]</td><td>[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]..[/COLOR][COLOR= #007700]]  .[/COLOR] [COLOR= #DD0000]</td></tr>[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</table>[/COLOR][COLOR= #007700];[/COLOR]
?>
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
nee want dan komt dezelfde 2X
er moet gwn:
1 2
3 4
etc.
0
Berichten
1.168
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ik kan morgen wel wat maken.
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
daar heb ik niks aan emoik heb het nu nodig
0
Berichten
1.168
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
kan je aangeven wat er precies zou moeten komen te staan, en uit welke tabel je het wilt halen?
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]../inc/config.php[/COLOR][COLOR= #007700]);[/COLOR]
?>
<a style="float: right;" class="lbAction" rel="deactivate">
<img src="images/cross.png" alt="Sluiten" />
</a>
<h3>
Muziek toevoegen
</h3>
<table>
[COLOR= #0000BB]<?php
$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM music ORDER BY naam ASC"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]))
{[/COLOR]
?>
<tr><td><a onclick="sound([COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]][/COLOR] ?>)">[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]][/COLOR] ?></a></td><td>[COLOR= #0000BB]<?php[/COLOR] [COLOR= #FF8000]/*2de*/[/COLOR] ?></td></tr>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]insert[/COLOR][COLOR= #007700]])){[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]HOI[/COLOR][COLOR= #007700];
}[/COLOR]
?>
</table>
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Ik kom net van school en heb even snel uit mijn hoofd gedaan, weet dus niet of het werkt:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]../inc/config.php[/COLOR][COLOR= #007700]);[/COLOR]
?>
<a style="float: right;" class="lbAction" rel="deactivate">
    <img src="images/cross.png" alt="Sluiten" />
</a>

<h3>Muziek toevoegen</h3>

<table>
    [COLOR= #0000BB]<?php
        $sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM music ORDER BY naam ASC"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
        [COLOR= #0000BB]$count[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700];[/COLOR]
        
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<tr>[/COLOR][COLOR= #007700];[/COLOR]
        [URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]))
        {[/COLOR]
            [COLOR= #0000BB]$count[/COLOR][COLOR= #007700]++;[/COLOR]
            ?>
                <td><a onclick="sound([COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]][/COLOR] ?>)">[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]][/COLOR] ?></a></td>
            [COLOR= #0000BB]<?php[/COLOR]
            [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$count[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700])
            {[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</tr><tr>[/COLOR][COLOR= #007700];[/COLOR]
                [COLOR= #0000BB]$count[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700];   
            }
        }[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</tr>[/COLOR][COLOR= #007700];[/COLOR]

        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]insert[/COLOR][COLOR= #007700]]))
        {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]HOI[/COLOR][COLOR= #007700];
        }[/COLOR]
    ?>
</table>
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Jaa werktpompom
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Volgens mij krijg je wel een rij teveel als je een even aantal rows hebt, maar ik zou het anders ook eventjes niet weten emo
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
had het getest met 4 rows en het werkte biggrin
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren