I'm working on a script to show all records from a certain table in my DB, but I can only make it show the first. How do I make it show all??? $query="SELECT * FROM names ORDER BY name DESC"; $result=mysql_query($query) or die("Unable to find requested user"); $currUser = mysql_fetch_array($result); ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><?php echo ("<b>" . $currUser['name'] . "</b>"); ?></td> </tr> </table></td> <td> </td> </tr> </table> Code (markup):
This is supposed to work fine, if it doesn't remember you just have to loop through the results from the DB.
Try this $query="SELECT * FROM names ORDER BY name DESC"; $result=mysql_query($query) or die("Unable to find requested user"); while ($currUser = mysql_fetch_array($result)) { ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><?php echo ("<b>" . $currUser['name'] . "</b>"); ?></td> </tr> </table></td> <td> </td> </tr> </table> <? } ?> Code (markup):
<?php query="SELECT * FROM names ORDER BY name DESC"; $result=mysql_query($query) or die("Unable to find requested user"); ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td>USER NAME</td> <td>COLUMN 2</td> </tr> <?php while ($currUser = mysql_fetch_array($result)) { ?> <tr> <td><?php echo $currUser['name']; ?></td> <td><?php echo $currUser['COL2']; ?></td> </tr> <? } ?> </table>