3 ms·
As I commented on the blog, he fell into the trap of needlessly looping over sets of data. 1) Loop over MySQL result set in GetArray 2) Loop over array of res
by k4st 18y ago
As I commented on the blog, he fell into the trap of needlessly looping over sets of data.
1) Loop over MySQL result set in GetArray
2) Loop over array of results to format them in GetVideos
3) assumed loop over results to eventually display them to the user.
All three steps could be accomplished at the same time by simply using iterators.
- jayair 18y agocould you give me a quick example of this?
- k4st 18y agoYes! I'm copying and pasting some code from various areas. Here is an old and slightly modified mysql result set iterator that fits the purposed of the newer code that makes this example nice: http://codepad.org/nmD4pDES http://codepad.org/nmD4pDES Here is a windowing iterator, it gives the person the ability to shift and pop elements from the inner iterator, thus narrowing the field that the iterator goes over: http://codepad.org/IsE5U7cw http://codepad.org/IsE5U7cw We can now do the following... http://codepad.org/nP0EEKxT http://codepad.org/nP0EEKxT
- jayair 18y agothx, appreciate it.