Username: Posted September 20, 2010 Share Posted September 20, 2010 Right now I just cheated and sorted by descending then put like thirty <br />'s so you couldn't see old ones. How can I do this properly? Link to comment https://forums.phpfreaks.com/topic/213886-display-latest-submition-to-an-sql-db/ Share on other sites More sharing options...
litebearer Posted September 20, 2010 Share Posted September 20, 2010 helps if you show us your code Link to comment https://forums.phpfreaks.com/topic/213886-display-latest-submition-to-an-sql-db/#findComment-1113204 Share on other sites More sharing options...
Username: Posted September 20, 2010 Author Share Posted September 20, 2010 helps if you show us your code lol i told you exactly what i did. <div id="html1" style="font-family:arial; font-size: 12px"> <?php mysql_connect("mysql", "15557_test", "********") or die("Could not connect: " . mysql_error()); mysql_select_db("15557_test"); $result = mysql_query("SELECT id FROM total ORDER BY id DESC"); while ($row = mysql_fetch_array($result, MYSQL_NUM)) { printf("<font color='white'>Total post count (since this was added): %s<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></font>", $row[0]); } mysql_free_result($result); ?> Link to comment https://forums.phpfreaks.com/topic/213886-display-latest-submition-to-an-sql-db/#findComment-1113207 Share on other sites More sharing options...
litebearer Posted September 20, 2010 Share Posted September 20, 2010 use LIMIT 1 in your query. In your case only the highest ID will be returned. IF the ID is auto increment, then that will be the most recent addition to your table Link to comment https://forums.phpfreaks.com/topic/213886-display-latest-submition-to-an-sql-db/#findComment-1113210 Share on other sites More sharing options...
Username: Posted September 20, 2010 Author Share Posted September 20, 2010 use LIMIT 1 in your query. In your case only the highest ID will be returned. IF the ID is auto increment, then that will be the most recent addition to your table Thanks for the fast answer, it works great ! Link to comment https://forums.phpfreaks.com/topic/213886-display-latest-submition-to-an-sql-db/#findComment-1113215 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.