Just a tip: be sure to test everything to make sure none of you commands fail.
i.e. connection, db selection, query, row count, seek, fetch.
After inserting your boolean tests for the remainder of your mysql commands and you find that they all work, your next step is to look at return values. Print your 'mysql_num_rows' result to see exactly how many rows are being returned. If you get your 20 rows that you are looking for, then you'll know your problem is in your loop.
You're using mysql_fetch_row instead of mysql_fetch_array. The array fetch will return values in an associative array, while the row fetch returns values in numbered indices. Try it out and let me know if this helps.