Jump to content

Last row from db


Gruzin

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.