The difficulty of using a "FOR" loop in a WHILE loop is that the data record doesn't change until the next WHILE loop. I've used variations of the following to get multiple columns of data from a database query. A variation of this should work.
while ($cards=mysql_fetch_array($result)) { if ($num==1) print "<tr>"; print "<td>"; print $db[item]; print "</td>"; $num++; if ($num==3) { print "</tr>"; $num=1; } } if ($num==2) print "</tr>"; print "</table>"; Hope this helps, Hugh ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, March 28, 2002 12:33 AM Subject: Re: [PHP] HELP PLEASE! At 27.03.2002 21:20, you wrote: Even if I didnīt read your code exactly, the fault is the do while loop replace it with something like this while ($row = mysql_fetch_array($result)) { for($i=0,$i < count($row);$i++) { // add something to make it fancy like a table or so echo $row[$i]; } } in php4* there is something like foreach, which I do not exactly know HTH Oliver >Hello, > >My problem is I have a form that submits it info to a mysql table, well >then I >have a page that calls it from the mysql table and displays whatever is in >the >mysql table. So, what script do I use to make it display multiple entrys?? >Here >is the code: > >--------------------------------------------------------------------------- > ><?php >$title = "Powder Basin Motocross, INC. | | Rider Profiles"; >include('header.php'); >$conn = @mysql_connect ("host", "un", "pw") > or die("Coudn't connect to the MySQL server."); >mysql_select_db (pbmi_riderprofiles) > or die("Couldn't the select MySQL database."); >?> ><table border="0" cellspacing="0" cellpadding="0"><tr> ><td class="mainheader" width="475" align="center" bgcolor="#666666">:: Rider >Profiles ::</td> ></tr> ><tr> ><td valign="top" align="left"> ><font size="<?=$fontsize?>" face="<?=$fontface?>"><a href="index.php? >topic=addprofile">Add your profile</a></font> ><hr width="475" align="left" noshade> ><table border="0" cellspacing="0" cellpadding="0"> ><tr> ><td><font size="<?=$fontsize?>" face="<?=$fontface?>"><b> First >Name:</b></font></td> ><td><font size="<?=$fontsize?>" face="<?=$fontface?>"><?php $result = >mysql_query ("SELECT * FROM riderprofiles first_name"); if ($row = >mysql_fetch_array($result)) { do { echo $row["first_name"]; } while ($row = >mysql_fetch_array($result)); } ?></font></td> ></tr> ><tr> ><td><font size="<?=$fontsize?>" face="<?=$fontface?>"><b> Last >Name:</b></font></td> ><td><font size="<?=$fontsize?>" face="<?=$fontface?>"><?php $result = >mysql_query ("SELECT * FROM riderprofiles last_name"); if ($row = >mysql_fetch_array($result)) { do { echo $row["last_name"]; } while ($row = >mysql_fetch_array($result)); } ?></font></td> ></tr> ><tr> ><td><font size="<?=$fontsize?>" face="<?=$fontface? > >"><b> D.O.B:</b></font></td> ><td><font size="<?=$fontsize?>" face="<?=$fontface?>"><?php $result = >mysql_query ("SELECT * FROM riderprofiles dob"); if ($row = mysql_fetch_array >($result)) { do { echo $row["dob"]; } while ($row = mysql_fetch_array >($result)); } ?></font></td> ></tr> ><tr> ><td><font size="<?=$fontsize?>" face="<?=$fontface? > >"><b> City:</b></font></td> ><td><font size="<?=$fontsize?>" face="<?=$fontface?>"><?php $result = >mysql_query ("SELECT * FROM riderprofiles city"); if ($row = mysql_fetch_array >($result)) { do { echo $row["city"]; } while ($row = mysql_fetch_array >($result)); } ?></font></td> ></tr> ><tr> ><td><font size="<?=$fontsize?>" face="<?=$fontface? > >"><b> State:</b></font></td> ><td><font size="<?=$fontsize?>" face="<?=$fontface?>"><?php $result = >mysql_query ("SELECT * FROM riderprofiles state"); if ($row = >mysql_fetch_array >($result)) { do { echo $row["state"]; } while ($row = mysql_fetch_array >($result)); } ?></font></td> ></tr> ><tr> ><td><font size="<?=$fontsize?>" face="<?=$fontface?>"><b> E- >mail:</b></font></td> ><td><font size="<?=$fontsize?>" face="<?=$fontface?>"><a href="mailto:<? >=$riderfile[$i + 5]?>"><?php $result = mysql_query ("SELECT * FROM >riderprofiles email"); if ($row = mysql_fetch_array($result)) { do { echo $row >["email"]; } while ($row = mysql_fetch_array($result)); } ?></a></font></td> ></tr> ><tr> ><td><font size="<?=$fontsize?>" face="<?=$fontface?>"><b> Dirt >Bike:</b></font></td> ><td><font size="<?=$fontsize?>" face="<?=$fontface?>"><?php $result = >mysql_query ("SELECT * FROM riderprofiles dirt_bike"); if ($row = >mysql_fetch_array($result)) { do { echo $row["dirt_bike"]; } while ($row = >mysql_fetch_array($result)); } ?></font></td> ></tr> ><tr> ><td><font size="<?=$fontsize?>" face="<?=$fontface? > >"><b> Class:</b></font></td> ><td><font size="<?=$fontsize?>" face="<?=$fontface?>"><?php $result = >mysql_query ("SELECT * FROM riderprofiles race_class"); if ($row = >mysql_fetch_array($result)) { do { echo $row["race_class"]; } while ($row = >mysql_fetch_array($result)); } ?></font></td> ></tr> ><tr> ><td><font size="<?=$fontsize?>" face="<?=$fontface?>"><b> Years >Riding:</b></font></td> ><td><font size="<?=$fontsize?>" face="<?=$fontface?>"><?php $result = >mysql_query ("SELECT * FROM riderprofiles yr"); if ($row = mysql_fetch_array >($result)) { do { echo $row["yr"]; } while ($row = mysql_fetch_array >($result)); } ?></font></td> ></tr> ><tr> ><td><font size="<?=$fontsize?>" face="<?=$fontface?>"><b> Favorite >Track:</b></font></td> ><td><font size="<?=$fontsize?>" face="<?=$fontface?>"><?php $result = >mysql_query ("SELECT * FROM riderprofiles favorite_track"); if ($row = >mysql_fetch_array($result)) { do { echo $row["favorite_track"]; } while >($row = >mysql_fetch_array($result)); } ?></font></td> ></tr> ><tr> ><td><font size="<?=$fontsize?>" face="<?=$fontface? > >"><b> Sponsors:</b></font></td> ><td><font size="<?=$fontsize?>" face="<?=$fontface?>"><?php $result = >mysql_query ("SELECT * FROM riderprofiles sponsors"); if ($row = >mysql_fetch_array($result)) { do { echo $row["sponsors"]; } while ($row = >mysql_fetch_array($result)); } ?></font></td> ></tr> ><tr> ><td><font size="<?=$fontsize?>" face="<?=$fontface? > >"><b> Injuries:</b></font></td> ><td><font size="<?=$fontsize?>" face="<?=$fontface?>"><?php $result = >mysql_query ("SELECT * FROM riderprofiles injuries"); if ($row = >mysql_fetch_array($result)) { do { echo $row["injuries"]; } while ($row = >mysql_fetch_array($result)); } ?></font></td> ></tr> ><tr> ><td><font size="<?=$fontsize?>" face="<?=$fontface? > >"><b> Comments:</b></font></td> ><td><font size="<?=$fontsize?>" face="<?=$fontface?>"><?php $result = >mysql_query ("SELECT * FROM riderprofiles comments"); if ($row = >mysql_fetch_array($result)) { do { echo $row["comments"]; } while ($row = >mysql_fetch_array($result)); } ?></font></td> ></tr> ><tr> ><td colspan="2"><hr width="475" align="left" noshade></td> ></tr> ></table> ><font size="<?=$fontsize?>" face="<?=$fontface?>"><a href="index.php? >topic=addprofile" style="font-size : 10pt;">Add your profile</a></font> ></td> ></tr> ></table> ><?php >include('footer.php'); >?> > >--------------------------------------------------------------------------- >That will only display one entry... how do i make it display all the entrys?? >Thanks!!!!!!!!!! > > >-Sean >Kennedy > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php