There are plenty of forums where you can post a "how-to" question and get a fairly immediate answer. The answer may even be correct. But WebmasterWorld is about teaching you how to do it yourself. That way you can roll your own htaccess-- not just for today's problem but for tomorrow's almost identical one.
Here is the analogy:
Your child's room needs cleaning. You know that you can clean it yourself much faster and better than if you have to stand over your child and force him to do it right. But if you do the "make him get it right" part often enough, you will have raised a child who knows how to clean his room-- and who will some day stand glowering over his own children in the same circumstances.
Some day, someone else will post a question in the WebmasterWorld forums and you'll say "Hey, I know the answer to that one!"
Besides, when someone with a very low post count asks a question, that person may have posted the identical question in six different forums. They grab the first answer they get, and never even come back to the others. You can understand that this is infuriating for the person who took the time to compose an answer.
Still with us? Let's have a look at what you have done so far. It sounds like the basic redirect-to-rewrite two-step. In fact I have another and much longer boilerplate about that one, so count your blessings. It's a very popular question, so the Forums should have lots of ideas to help you get started.
Unless we're talking about only a small number of URLs you'll need to rewrite the request to a special PHP script that looks in the database for the name for the ID and then sends a 301 HEADER directive.
You'll also need to modify the PHP script that runs the site to link to the new URLs from the pages of the site. Clicking navigation links within a site should never lead to a redirect.