Probleem met tabbellen

Gestart doorNathan1 reacties39 weergaven

2 berichten · pagina 1 van 1

Nathan

Lid · Topicstarter

Berichten
4.936
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik zit met een klein probleem (sorry voor het tweede topic) ik heb dus dit stuk:

<!-- / FCb-->
<div class="left1">
    <div class="yellow-top">
    </div>
    <div class="yellow-main">
        <table>
            <tr>
                <td><img src="../images/world.png" alt="new" /></td>
                <td><b>More games</b></td>
            </tr>
        </table>
        <div class="yellow-games">
[COLOR= #0000BB]<?php
$sql[/COLOR]  [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT id, name, url FROM $cat ORDER BY id LIMIT 50"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$obj[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_object"]mysql_fetch_object[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700])) {[/COLOR]

                                    [COLOR= #0000BB]$g[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$obj[/COLOR][COLOR= #007700]->[/COLOR]id[COLOR= #007700];[/COLOR]
                                    [COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]= ([/COLOR][COLOR= #0000BB]$g[/COLOR] / [COLOR= #0000BB]2[/COLOR][COLOR= #007700]);[/COLOR]
                                    [COLOR= #0000BB]$j[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/round"]round[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]);[/COLOR]

                                    [COLOR= #0000BB]$r[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$j[/COLOR] [COLOR= #007700]-[/COLOR] [COLOR= #0000BB]$i[/COLOR][COLOR= #007700];[/COLOR]
                                    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$r[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
                                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<div class="yellow-games-light">"[/COLOR][COLOR= #007700];[/COLOR]
                                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"- <a href="/page/game/"[/COLOR][COLOR= #007700];[/COLOR]
                                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$obj[/COLOR][COLOR= #007700]->[/COLOR]url[COLOR= #007700].[/COLOR][COLOR= #DD0000]"">"[/COLOR][COLOR= #007700];[/COLOR]
                                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$obj[/COLOR][COLOR= #007700]->[/COLOR]name[COLOR= #007700].[/COLOR][COLOR= #DD0000]"</a><br />"[/COLOR][COLOR= #007700];[/COLOR]
                                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"</div>"[/COLOR][COLOR= #007700];
                                    }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
                                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<div class="yellow-games-normal">"[/COLOR][COLOR= #007700];[/COLOR]
                                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"- <a href="/page/game/"[/COLOR][COLOR= #007700];[/COLOR]
                                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$obj[/COLOR][COLOR= #007700]->[/COLOR]url[COLOR= #007700].[/COLOR][COLOR= #DD0000]"">"[/COLOR][COLOR= #007700];[/COLOR]
                                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$obj[/COLOR][COLOR= #007700]->[/COLOR]name[COLOR= #007700].[/COLOR][COLOR= #DD0000]"</a><br />"[/COLOR][COLOR= #007700];[/COLOR]
                                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"</div>"[/COLOR][COLOR= #007700];
                                    }
                                }[/COLOR]
                                ?>

        </div>
    </div>
    <div class="yellow-bottom">
    </div>
</div>
                    <!-- / FCb-->


Dat stuk weergeeft de database gegevens in een tabel nou staan er normaal 4 van die tabbellen naast elkaar op de homepage (Gevuld met dingen per categorie 12 stuks) nou wil ik op de subpagina geen hele lange rij met (soms) 100 dingen. Want dat staat zo leeg aan de rechterkant aangezien er normaal 4 vakken naast elkaar horen en met de code hierboven word het één lange rij.

Wat wil ik ik wil dus dat er 4 tabellen naast elkaar komen te staan met in iedere tabel één ding en dat zo steeds onder elkaar hoe kan ik dit doen.. confused
Heb nog 0,17 punten die krijgt de gene met de oplossing?
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Voor als je met werkt kan je dit gebruiken:

[COLOR= #0000BB]<?php
$i[/COLOR][COLOR= #007700]++;[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]1[/COLOR] [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]<tr>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]Hier de teksten enzo[/COLOR][COLOR= #007700].([/COLOR][COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]4[/COLOR] [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]</tr>[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]4[/COLOR][COLOR= #007700]){[/COLOR] [COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]; }[/COLOR]
?>


Dat zet je dan in je while
$i++ bovenaan
En de if onderaan

EDIT:
Je gebruikt $i als zie ik dus maak er maar een ander naampje vanxd
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