altere sua consulta para: // select record from mysql $sql="SELECT * FROM $tbl_name order by id desc";