Gruzin Posted September 20, 2006 Share Posted September 20, 2006 Hi guys,I have a very simple question: how can I echo the last row from db? Thanks for your time,George Link to comment https://forums.phpfreaks.com/topic/21404-last-row-from-db/ Share on other sites More sharing options...
obsidian Posted September 20, 2006 Share Posted September 20, 2006 if you have an auto-incrementing id field, you can simply sort by that field:[code]<?php$sql = mysql_query("SELECT * FROM table ORDER BY id DESC LIMIT 1");$row = mysql_fetch_row($sql);foreach ($row as $key => $val) echo "$key => $val<br />\n";?>[/code]hope this helps Link to comment https://forums.phpfreaks.com/topic/21404-last-row-from-db/#findComment-95323 Share on other sites More sharing options...
Gruzin Posted September 20, 2006 Author Share Posted September 20, 2006 Thanks obsidian, think it will help me ;) Link to comment https://forums.phpfreaks.com/topic/21404-last-row-from-db/#findComment-95333 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.