login  Naam:   Wachtwoord: 
Registreer je!
 Forum

Weergeven van de namen

Offline roelh - 07/03/2008 17:50 (laatste wijziging 07/03/2008 18:01)
Avatar van roelhPHP gevorderde hey allemaal,

Ik heb nu deze code.
Hij doet het goed, alleen nu wil ik dat hij 2 namen achter elkaar weergeeft.
Het is een voetbal competitie, dus 2 verschillende namen moet het worden...
Hij wil dit niet goed en het werkt ook niet zoalsik het wil.
Kan iemand me aub helpen?

groet,

[url=http://www.plaatscode.be/5960]Plaatscode: 5960[/url]

Hier de print_r van $row:
Citaat:
Array ( [0] => 1 [1] => Roel Harmsen [2] => f0068f9aeb68b770dbd431cd788c4e0b [3] => Beheerder [4] => 1 [5] => 1 [6] => Ghana [7] => Fenerbache [8] => 1 [9] => 2 [10] => 15 ) Array ( [0] => 2 [1] => Jelle Bonnes [2] => [3] => Lid [4] => 1 [5] => 1 [6] => Ghana [7] => Fenerbache [8] => 1 [9] => 2 [10] => 15 ) Array ( [0] => 3 [1] => Mark Brinkhuis [2] => [3] => Lid [4] => 1 [5] => 1 [6] => Ghana [7] => Fenerbache [8] => 1 [9] => 2 [10] => 15 ) Array ( [0] => 1 [1] => Roel Harmsen [2] => f0068f9aeb68b770dbd431cd788c4e0b [3] => Beheerder [4] => 2 [5] => 1 [6] => Kroatie [7] => Roemenie [8] => 1 [9] => 3 [10] => 10 ) Array ( [0] => 2 [1] => Jelle Bonnes [2] => [3] => Lid [4] => 2 [5] => 1 [6] => Kroatie [7] => Roemenie [8] => 1 [9] => 3 [10] => 10 ) Array ( [0] => 3 [1] => Mark Brinkhuis [2] => [3] => Lid [4] => 2 [5] => 1 [6] => Kroatie [7] => Roemenie [8] => 1 [9] => 3 [10] => 10 ) Array ( [0] => 1 [1] => Roel Harmsen [2] => f0068f9aeb68b770dbd431cd788c4e0b [3] => Beheerder [4] => 3 [5] => 1 [6] => Japan [7] => Rangers [8] => 2 [9] => 3 [10] => 10 ) Array ( [0] => 2 [1] => Jelle Bonnes [2] => [3] => Lid [4] => 3 [5] => 1 [6] => Japan [7] => Rangers [8] => 2 [9] => 3 [10] => 10 ) Array ( [0] => 3 [1] => Mark Brinkhuis [2] => [3] => Lid [4] => 3 [5] => 1 [6] => Japan [7] => Rangers [8] => 2 [9] => 3 [10] => 10 ) Array ( [0] => 1 [1] => Roel Harmsen [2] => f0068f9aeb68b770dbd431cd788c4e0b [3] => Beheerder [4] => 4 [5] => 1 [6] => Costa Rica [7] => Griekenland [8] => 1 [9] => 2 [10] => 5 ) Array ( [0] => 2 [1] => Jelle Bonnes [2] => [3] => Lid [4] => 4 [5] => 1 [6] => Costa Rica [7] => Griekenland [8] => 1 [9] => 2 [10] => 5 ) Array ( [0] => 3 [1] => Mark Brinkhuis [2] => [3] => Lid [4] => 4 [5] => 1 [6] => Costa Rica [7] => Griekenland [8] => 1 [9] => 2 [10] => 5 ) Array ( [0] => 1 [1] => Roel Harmsen [2] => f0068f9aeb68b770dbd431cd788c4e0b [3] => Beheerder [4] => 5 [5] => 1 [6] => Portsmouth [7] => Classic Netherland [8] => 1 [9] => 3 [10] => 10 ) Array ( [0] => 2 [1] => Jelle Bonnes [2] => [3] => Lid [4] => 5 [5] => 1 [6] => Portsmouth [7] => Classic Netherland [8] => 1 [9] => 3 [10] => 10 ) Array ( [0] => 3 [1] => Mark Brinkhuis [2] => [3] => Lid [4] => 5 [5] => 1 [6] => Portsmouth [7] => Classic Netherland [8] => 1 [9] => 3 [10] => 10 ) Array ( [0] => 1 [1] => Roel Harmsen [2] => f0068f9aeb68b770dbd431cd788c4e0b [3] => Beheerder [4] => 6 [5] => 1 [6] => Australie [7] => Lille OSC [8] => 2 [9] => 3 [10] => 5 ) Array ( [0] => 2 [1] => Jelle Bonnes [2] => [3] => Lid [4] => 6 [5] => 1 [6] => Australie [7] => Lille OSC [8] => 2 [9] => 3 [10] => 5 ) Array ( [0] => 3 [1] => Mark Brinkhuis [2] => [3] => Lid [4] => 6 [5] => 1 [6] => Australie [7] => Lille OSC [8] => 2 [9] => 3 [10] => 5 )

4 antwoorden

Gesponsorde links
Offline Stijn - 07/03/2008 23:13
Avatar van Stijn PHP expert Gewoon een teller'ke en modulo 2 

  1. $i = 0;
  2. while( $row = mysql_fetch_row($query) ) {
  3.  
  4. echo $row[1];
  5.  
  6. if( ++$i%2 == 0 )
  7. echo "<br />";
  8. else
  9. echo " - "; //speler 1 - speler 2
  10.  
  11. }
Offline roelh - 08/03/2008 10:49
Avatar van roelh PHP gevorderde Thanks man, super Niet eens aan gedacht zo 
Heb nog een klein probleempje.

Heb 6 wedstrijden in de tabel staan.
maar hij geeft er acht weer.
Dit is de code die ik nu gebruik.

Plaatscode: 5962
Offline Ibrahim - 08/03/2008 11:58
Avatar van Ibrahim PHP expert gebruik JOINS voor selecteren uit meerdere tabellen

DISTINCT om dubbele records te voorkomen
Offline roelh - 09/03/2008 23:59
Avatar van roelh PHP gevorderde Het selecteren uit meerdere tabellen is al gelukt 
Alleen dubbele recors wil nog niet zo, maar ik ga eraan werken, bedankt voor je informatie iig 
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 1.612s