AS3 replaced AS2 patchy getVersion with the flash.system.Capabilities class. There you will find a property called a version that will give you what you want. This is not in Javascript or PHP, but a small (and possibly invisible) SWF can easily send a receive request to the server page to send information to your database.
If you need a query that needs to be executed in Javascript, for some reason it is possible (though not fluid) to support AS3 and Javascript communication.
source share