Thanks to you all for the replies. Adrian, your solution is working for me without errors but it's not actually inserting anything. I'll keep fiddling with it and see if I can get what I want but I'm confident now that I'm on the right path. As a backup, I did what I wanted to in Javascript and wrote it to a file that I serve from my server when users request it. Thanks again!
Adrian didn't write it as an insert statement (hence the lack of the word INSERT)...though you've been pointed the correct direction on that topic in other responses.