Welcome to PHPBuilder!
The first thing I'd do is to stop using the outdated, pseudo-deprecated [man]mysql[/man] library and instead switch to something like the newer, improved [man]MySQLi[/man] library.
Next, I'd probably use something like [man]mysqli_fetch_all/man. I'd also recommend not using a 'SELECT *' query but instead only SELECT'ing the columns from which you actually need data.