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

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

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