When selecting an displaying data using PHP and MySql, how can I get value of the last row in a record set? Is there a built in function in MySql or Php to do this?
For Eg (using PDO):
select id from table limit 5;
Output:
1
2
3
4
5 -> How can I get this value to pass to a function, all things being the same
while( $row = $stmt->fetch() ) {
echo $row['id'];
}
// The value of id of the last row i.e 5 needs to go into a function
functionName(id value of last row goes here)
How can this be done?