ArizonaJohn Posted February 26, 2010 Share Posted February 26, 2010 Hello, I have a MySQL table with a structure similar to this: id1 id2 title url date I would like to print out a simple table in PHP that with the following structure sorted in reverse chronological order for the most recent 10 entries (date above = date submitted) from the MySQL table: title id2 How could I do this? Thanks in advance, John Quote Link to comment https://forums.phpfreaks.com/topic/193427-printing-results-in-a-simple-table/ Share on other sites More sharing options...
nilansanjaya Posted February 26, 2010 Share Posted February 26, 2010 <?php //my sql connection goes here. $sql = "select * from yourtablename"; $results = mysql_query($sql); echo "<table><tr><th>title</th><th>id2</th></tr>"; while($row = mysql_fetch_array($results)){ <tr><td>$row['title']</td><td>$row['id2']</td></tr>; } echo "</table>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/193427-printing-results-in-a-simple-table/#findComment-1018348 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.