I figured it out. When copying and pasting from your code you put on the thread, there are SPACES at the end of each line. So it doesn't read that entire PHP code snippet whatsoever.
So it doesn't see the recordset.
That's the only difference. When I deleted the extra space at the end of the line, it worked fine.