Re: Not Looping...

From: Date: Thu, 15 Mar 2001 07:29:34 +0000
Subject: Re: Not Looping...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-43985@lists.php.net to get a copy of this message
On Thu, 15 Mar 2001 17:48, WreckRman2 wrote: > I am having problems figuring out how to loop to show more then one > record... Any help would be great... All I can get is the first > record... > > Thanks... > > Code: > > <?php > > $db = mysql_connect("localhost", "root", "*****"); > mysql_select_db("indywebdesign",$db); > > $invoices_result = mysql_query("select * from invoices WHERE > customerid=$id ORDER BY invoiceid DESC"); > $invoices = mysql_fetch_array($invoices_result); > > ?> > > <TR> > <TD BGCOLOR="#EAEAEA"><FONT FACE="Tahoma" > SIZE="2"><?php echo > $invoices["date"] ?></FONT></TD> > <TD BGCOLOR="#EAEAEA"><FONT FACE="Tahoma" > SIZE="2"><?php echo > $invoices["amount"] ?></FONT></TD> > <TD BGCOLOR="#EAEAEA" COLSPAN="2"><FONT > FACE="Tahoma" > SIZE="2"><?php echo $invoices["description"] > ?></FONT></TD> > </TR> Check out the example in the manual for mysql_fetch_array, using a while loop. Also see extracrt to save a bit of typing :-) -- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA

« previous php.general (#43985) next »