The method you're using seems wasteful in a couple of ways; first off, you're pulling down the entire set of records (since I can't see your SQL I can't confirm this, of course) rather than a specific result set from a properly formed SELECT statement. Secondly, you're using
mysql_fetch_array() without specifying the result type, MYSQL_ASSOC (associative array) or MYSQL_NUM (numerically indexed array) so you're getting twice the array you require for your purposes.
I'm curious as to what your SELECT statement looks like; that's alot of code to do something that could potentially be done with a properly formed SQL query. Looking for specific records that match a criteria and then limiting the resultset to 8 records (1+ the following 7) should be simple.