how to get next user id? : I wanna print two rows, first with next five users and second with next 25 users after 5, I am getting an error while getting next id

     $quary= mysql_query("SELECT * FROM user ORDER BY  id  ASC ");
     while($auto_inc_result = mysql_fetch_array($quary))
     {
     $last_id = $auto_inc_result['id'];
     }
     $next_id = ($last_id+1);
    
    
     echo $next_id;