om de 4 een <br>

Gestart doorSmiegles11 reacties127 weergaven

12 berichten · pagina 1 van 1

Smiegles

Lid · Topicstarter

Berichten
4.912
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
He
ik heb deze code

[COLOR= #0000BB]<?php
        $sql[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT * FROM fotos ORDER BY id ASC"[/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= #0000BB]$sql[/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_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700])) {[/COLOR] ?>
        <a href="admin/[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]foto[/COLOR][COLOR= #007700]];[/COLOR] ?>" rel="lightbox[show]" title="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR] ?>"><IMG src="admin/[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]foto[/COLOR][COLOR= #007700]];[/COLOR] ?>"height=96 width=96 border=1></a><br>
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR] ?><br />
[COLOR= #0000BB]<?[/COLOR] [COLOR= #007700]}[/COLOR] ?>


hoe zorg ik ervoor dat om de 4 x dat ik iets uit de database een
doet?
0
Berichten
15.303
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Het ding na in de while 4 keer neerzetten en dan na die 4 keer een br?

Zoiets dus:

[COLOR= #0000BB]<?php
        $sql[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT * FROM fotos ORDER BY id ASC"[/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= #0000BB]$sql[/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_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700])) {[/COLOR] ?>
        <a href="admin/[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]foto[/COLOR][COLOR= #007700]];[/COLOR] ?>" rel="lightbox[show]" title="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR] ?>"><IMG src="admin/[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]foto[/COLOR][COLOR= #007700]];[/COLOR] ?>"height=96 width=96 border=1></a><br>
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR] ?><br /><a href="admin/[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]foto[/COLOR][COLOR= #007700]];[/COLOR] ?>" rel="lightbox[show]" title="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR] ?>"><IMG src="admin/[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]foto[/COLOR][COLOR= #007700]];[/COLOR] ?>"height=96 width=96 border=1></a><br>
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR] ?><br /><a href="admin/[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]foto[/COLOR][COLOR= #007700]];[/COLOR] ?>" rel="lightbox[show]" title="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR] ?>"><IMG src="admin/[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]foto[/COLOR][COLOR= #007700]];[/COLOR] ?>"height=96 width=96 border=1></a><br>
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR] ?><br />
<br>
[COLOR= #0000BB]<?[/COLOR] [COLOR= #007700]}[/COLOR] ?>
0
Berichten
1.631
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Kan je iets meer uitleg geven?
0
Berichten
3.314
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Opzich zou je ze met float:left makkelijk kunnen sorteren maar zoals jij het wil,

[COLOR= #0000BB]<?php
        $sql[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT * FROM fotos ORDER BY id ASC"[/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= #0000BB]$sql[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$counter[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]0[/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_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700])) {[/COLOR]

[COLOR= #0000BB]$counter[/COLOR][COLOR= #007700]++;[/COLOR]
 ?>
        <a href="admin/[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]foto[/COLOR][COLOR= #007700]];[/COLOR] ?>" rel="lightbox[show]" title="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR] ?>"><IMG src="admin/[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]foto[/COLOR][COLOR= #007700]];[/COLOR] ?>"height=96 width=96 border=1></a><br>
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR] ?><br />
[COLOR= #0000BB]<?[/COLOR] 
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$counter[/COLOR] [COLOR= #007700]%[/COLOR] [COLOR= #0000BB]4[/COLOR] [COLOR= #007700]==[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<br />"[/COLOR][COLOR= #007700];
}
}[/COLOR] ?>


edit: counter++; boven ipv onder
0
Berichten
15.446
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
hij bedoeld dat er 4 items horizontaal naast erlkaar moeten komen te staan en dat er dan automatisch een
komt en dat de vogende rij komt met 4 items.
Ik zoek ook zoiets namelijk, en de oplossing van Kyron doet dus niet wat er gedaan moet worden.
0
Smiegles

Lid · Topicstarter

Berichten
4.912
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Marjolein schreef:
hij bedoeld dat er 4 items horizontaal naast erlkaar moeten komen te staan en dat er dan automatisch een
komt en dat de vogende rij komt met 4 items.
Ik zoek ook zoiets namelijk, en de oplossing van Kyron doet dus niet wat er gedaan moet worden.
Dat bedoel ik
0
Berichten
6.722
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php
        $sql[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT * FROM fotos ORDER BY id ASC"[/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= #0000BB]$sql[/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_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700])) {[/COLOR] ?>
        <a href="admin/[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]foto[/COLOR][COLOR= #007700]];[/COLOR] ?>" rel="lightbox[show]" title="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR] ?>"><IMG src="admin/[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]foto[/COLOR][COLOR= #007700]];[/COLOR] ?>"height=96 width=96 border=1></a><br>
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR]
        [COLOR= #0000BB]$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]4[/COLOR][COLOR= #007700]) ?[/COLOR] [COLOR= #DD0000]<br />[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR]
        [COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]= ([/COLOR][COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]4[/COLOR][COLOR= #007700]) ?[/COLOR] [COLOR= #0000BB]0[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #0000BB]$i[/COLOR][COLOR= #007700];
}[/COLOR] ?>
0
Berichten
3.314
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Marjolein schreef:
hij bedoeld dat er 4 items horizontaal naast erlkaar moeten komen te staan en dat er dan automatisch een
komt en dat de vogende rij komt met 4 items.
Ik zoek ook zoiets namelijk, en de oplossing van Kyron doet dus niet wat er gedaan moet worden.
Wat doet mijn script dan niet wat gedaan moet worden?
0
Berichten
6.722
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Als je goed kijkt zie je dat er bij jou altijd een br krijgt maar na elke 4 een extra. Die van mij werkt wel. wink
0
Berichten
15.446
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Kyron schreef:
Eerdere citaten tonen
Marjolein schreef:
hij bedoeld dat er 4 items horizontaal naast erlkaar moeten komen te staan en dat er dan automatisch een
komt en dat de vogende rij komt met 4 items.
Ik zoek ook zoiets namelijk, en de oplossing van Kyron doet dus niet wat er gedaan moet worden.

Wat doet mijn script dan niet wat gedaan moet worden?
jouw script doet:
1
1
1
1

1
1
1
1
maar het moet:
1 1 1 1
1 1 1 1
Ik heb inmiddels ook een script gevonden die wel goed werkt. Als die van wiitse niet werkt dan geef je maar een seintje.
0
Berichten
3.314
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Haal dan die Br gewoon weg?

Beter dan die van Wiitse

[COLOR= #0000BB]<?php
        $sql[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"SELECT * FROM fotos ORDER BY id ASC"[/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= #0000BB]$sql[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$counter[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]0[/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_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700])) {[/COLOR]

[COLOR= #0000BB]$counter[/COLOR][COLOR= #007700]++;[/COLOR]
 ?>
        <a href="admin/[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]foto[/COLOR][COLOR= #007700]];[/COLOR] ?>" rel="lightbox[show]" title="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR] ?>"><IMG src="admin/[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]foto[/COLOR][COLOR= #007700]];[/COLOR] ?>"height=96 width=96 border=1></a>
        [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]];[/COLOR] ?><br />
[COLOR= #0000BB]<?[/COLOR] 
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$counter[/COLOR] [COLOR= #007700]%[/COLOR] [COLOR= #0000BB]4[/COLOR] [COLOR= #007700]==[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<br />"[/COLOR][COLOR= #007700];
}
}[/COLOR] ?>
0
Berichten
6.722
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
1: Je hebt hem nog steeds laten stan op regel 10.
2: Waarom is die van jou beter? Die van mij is tenminste beter uitgelijnd. En wat doet die op regel 11? Die van mij is ook gewoon korter, dus ik weet niet waar je de informatie vandaan haalt dat die van jou beter is.
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