how to select the last record from mysql database through sql query using php
Do you have a date added column?
$link = new mysqli('localhost', 'user', 'password', 'db_name');
if($link->connect_error) exit('DB connection error');
if(!$result = $link->query("SELECT field1, field2 FROM `table` ORDER BY dateAdded DESC LIMIT 1")) {
exit("There are no rows");
}
while($row = $result->fetch_assoc()) {
$row['field1'];
$row['field2']; //...
}
If not use an auto increment
Thanx it works done i have solved the problem