Reputation: 8262
How do i select from table the most recently updated row. My syntax seems to be wrong.
<?php
require_once 'db_conx.php';
$Result = mysql_query("SELECT * FROM 'table' WHERE lastupdated('timestamp') = CURDATE()") or die (mysql_error());
while($row = mysql_fetch_array($Result))
{
echo $row['name'] . "" .$row['phoneno'];
}
mysql_close($con);
?>
Upvotes: 0
Views: 927
Reputation: 8179
Try this..
SELECT * FROM 'table' ORDER BY lastupdated DESC LIMIT 1
Upvotes: 0
Reputation: 13465
If you need the latest record which was last updated then you can Try this::
SELECT * FROM 'table' order by lastupdated desc limit 1
Upvotes: 2