LOL, You cant do that as JavaScript is at client side and MySQL is on the server side.

Though you cant do that with purely JavaScript you can however communicate with a server through an xmlhttprequest object, its referred to as AJAX (or activex, java, actionscript)