What you're talking about is the basis of web application programming, and the answer is a resounding yes. This is what PHP was designed for. Read up on PHP at http://www.php.net/
Feel free to contact me if you need any advice or tips.
P.S. And yes, Dreamweaver MX can be used to do everything you described, including work with PHP.