First, you need to create a separate PHP file with the PHP/MySQL codings; for what this file outputs, will be grabbed by AJAX and displayed on the screen.
Secondly, Instead of using the requested HTTPRequest as suggested by most AJAX tutorials, use JavaScript's derivative, jQuery. You can learn jQuery at http://www.jquery.com
This JavaScript derivative makes creating asynchronous server scripts much smaller, saving unnecessary code.
Instead of typing a bunch of stuff for the AJAX's HTTPRequest, you could simply type:
$.ajax( ...Some parameters ...);
Which is very convienents and saves time.
Good Luck!
If you need further assistance/advice, feel free to contact me.