php - How can I get the last row from a table mysqli? -


i have table , trying recent row using code:

include "db_conx.php";  $sql="select column table order desc limit 1";  if ($result=mysqli_query($db_conx,$sql))   {   while ($row=mysqli_fetch_row($result))   {   printf($row[0]);   }   mysqli_free_result($result); } 

it returns blank result though.

order desc limit 1 

order what desc? have provide column name want order by. auto increment column, primary key or timestamp etc

as stands query has invalid syntax , not return other error.


Comments

Popular posts from this blog

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -

php - Prepared Statement Inner Join Cannot Pass Parameter by Reference -

c# - Value cannot be null or empty.\r\nParameter name: name -