Hello good afternoon. How can I clean a screen after querying a database. It turns out that I have a call to the database to show data in another database but I have the problem that when the main database has no relationship to the other database the page still shows the previous data. I would like to make a clear and I don’t know how to do it. Thank you.
Hi,
When querying a database you should handle a case when no items are found (e.g.
if(results.items.length > 0) {
let firstItem = results.items[0];
} else {
// handle case where no matching items found
}
click here to learn more)
You can create a default item that will be displayed.
To provide more details, please share a link to your site and name of the page where you wish to implement this solution so we have a clearer view on it.