Put the PHP file in your www folder.
Open the file in Notepad
Find mysql_connect.
In the following fields in the parenthesis, replace it all with: ("localhost", "root", "YOUR MYSQL PASSWORD")
Save the file.
Go to localhost/<filenamehere>.php
Should work. If you did not give your web server the default port 80, then do "localhost:PORT" (if it still doesn't work, Apache might not running. If it does not display correctly, something is wrong with either PHP or MySQL).
How to find your IP ->
Now, if you're behind a router, open port 80 (or the port you gave it) & then your web server now works for external connections (if your ISP does not block port 80).
Type into your web browser <YOURIP>/<filename>.php OR <YOURIP>:<PORT>/<filename>.php