You would need to perform a data seek in order to be able to fetch the result set again.
However, forget about that. You need to separate the different concerns in your code, which will make it easier to design, write, test, debug, and maintain your code and make it easier to change the data-source, such as switching to the PDO database extension. The database specific code should not be inside the html document. You should put the database specific code before the start of the html document, fetch all the data from the query into an appropriately named php variable, then test/loop over that variable inside the html document. For what you are currently asking about, you would just test/loop over that variable a second time.