HTML Portlet - Show portlet when data it's empty


Is there a way to show the portlet content when the data variable it's empty? I am trying to use a custom html portlet in some projects to built my own custom search link button, and If the query returns nothing, the html portlet don't show anything. There's two buttons that I've put on a table, and at least one should be visible so the users can create the item related to the portlet. But since the query it's empty, the button it's hidden.