title: mysql get previous and next record id
body: <p>I am trying to create a "Previous" and a "Next" button, showing 1 last previous record and 1 coming next record, to be generated by a sql statement.</p>
  
  <p>However, the id is not simply -1 and +1, which means if this record id is 40, the previous id might be 31 while the next id might be 43.</p>
  
  <p>Would there be any sql function that can allow me to achieve this goal? Thanks!</p>