How do I integrate flash and php

Can anyone help me integrate my flash game into my php based user authenticaion system.

Basically what I’m trying to do is when you load the game up, it loads a set of variables that are stored in a mySQL database, based on what user you are logged in as. How do I retrieve these variables with flash and equally as important, write new ones?

The game is written in AS2, though I will be expanding into a new AS3 project soon so advice on both is very helpful.

Thanks in advance for any help.