For starters the above code has absolutely nothing to do with troubleshooting a connection to your database server.
gagan22: Is your site throwing any php errors and/or any mysql connection errors?
if you're not getting any errors or are simply getting a blank page, I would create a separate file and try something like the following, to troubleshoot your connection issue.
<?php
error_reporting( E_ALL );
$link = mysql_connect("localhost", "mysql_user", "mysql_password") or die( mysql_error() );
mysql_select_db('foo', $link) or die( mysql_error() );
run that script but replacing the login information with your login details and the database name with your database name. If it works then the problem lies elsewhere. If that returns a php or mysql error then please post it back here and i'm sure everyone will be able to help you out once we see what is actually going on.