You're updating your $result variable in the nested while. So by the time your inner while completes, when it goes back up to the outer, there are no more fetches left to do. Use $iresult or $tickers for the results of your inner query.

Justin