Compare flash dynamic text to db

Hello!

I´m trying to make a wordgame in flash.
Lets say I have a dynamic text field with the letters “THENTERM”
How can I compare this string to a db with alot of words??
I want flash to show a list of all words that where found in the db.
Like this:

THE
THEN
ENTER
TERM

I know how to connect to my db using php.
But when it come´s to the search and compare thing,
I have no idea of what I should do…
Is it very complicated to do this using flash and php??

Sorry if my english is bad…

//M