I have a database and I would always fetch the value before, and I have used it for example:
I'll get a news, and on this page has a link to the previous news, and I'll search for it by searching for the current news id - 1, but in this way, it will go to ids that may not exist or have been deleted , is there a way to ignore the empty ones and do the query again?