PHP と MySql を使用して表示データを選択する場合、レコード セットの最後の行の値を取得するにはどうすればよいですか? これを行うためにMySqlまたはPhpに組み込み関数はありますか?
例 (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)
これはどのように行うことができますか?