RE: [PHP-WIN] beginner: why does this not work

From: Date: Tue, 06 May 2003 19:58:55 +0000
Subject: RE: [PHP-WIN] beginner: why does this not work
Groups: php.windows 
Request: Send a blank email to php-windows+get-19784@lists.php.net to get a copy of this message
try something like this: while ($rij = mysql_fetch_array($result)) { echo "<tr><td width='100%' bgcolor='white'><font size='2'>VOORNAAM:".$rij["voornaam"]."</td></tr>"; echo "<tr><td width='100%' bgcolor='white'><font size='2'>ACHTERNAAM:".$rij["achternaam"]."</td></tr>"; and so on... } this way you'll echo out all the data in the database not just the last entry(in the current setup.) -----Original Message----- From: cablenews.casema.net [mailto:staafmixer@wanadoo.nl] Sent: Thursday, May 01, 2003 8:27 PM To: php-windows@lists.php.net Subject: [PHP-WIN] beginner: why does this not work Maybe a beginner question.... Could someone please explain to me why this code doesn't work? I really don't get it... Greetz Tristan. <html> <head><title>persoon administratie</title> <body> <?php //the database-connection works mysql_connect ('localhost','',''); mysql_select_db("tristan"); //selecting every colomn in the database. $query = "SELECT voornaam, achternaam, adres, adres_nr, postcode, woonplaats, telefoonnr, geslacht, notitie, id FROM persoon"; $result = mysql_query($query); //this is where my error occurs while ($rij = mysql_fetch_array($result)) { $voornaam = $rij["voornaam"]; $achternaam = $rij["achternaam"]; $adres = $rij["adres"]; $adresnr = $rij["adres_nr"]; $postcode = $rij["postcode"]; $woonplaats = $rij["woonplaats"]; $telefoonnr = $rij["telefoonnr"]; $geslacht = $rij["geslacht"]; $notitie = $rij["notitie"]; $id = $rij["id"]; print ("<center><table border='2' width='100%' bordercolor='black' cellspacing='1'>\n"); print ("<tr><td width='100%' bgcolor='white'><font size='2'>VOORNAAM: $voornaam"); print ("<tr><td width='100%' bgcolor='white'><font size='2'>ACHTERNAAM: $achternaam"); print ("<tr><td width='100%' bgcolor='white'><font size='2'>ADRES: $adres"); print ("<tr><td width='100%' bgcolor='white'><font size='2'>ADRESNR: $adresnr"); print ("<tr><td width='100%' bgcolor='white'><font size='2'>POSTCODE: $postcode"); print ("<tr><td width='100%' bgcolor='white'><font size='2'>WOONPLAATS: $woonplaats"); print ("<tr><td width='100%' bgcolor='white'><font size='2'>TELEFOONNR: $telefoonnr"); print ("<tr><td width='100%' bgcolor='white'><font size='2'>GESLACHT: $geslacht"); print ("<tr><td width='100%' bgcolor='white'><font size='2'>NOTITIE: $notitie"); print("</table></center><br><br>\n\n"); } ?> </body> </html> -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.windows (#19784) next »