i hope i posted this thread at the right place

i am new to web development. i have no idea how does a website login to mysql database?
i have created a database at localhost, but no idea how to do it? search through google, try lots of sample but can't get it work.
My HTML scripts:
<form method="post" action="php/login.php" >
Login:<br />
<input type="text" name="login" /><br />
Password:<br />
<input type="text" name="pass" /><br />
<input type="submit" value="Sign in" /><br />
</form>
My PHP script:
<?
/*Use of Sessions*/
if(!session_id())
session_start();
header("Cache-control: private"); //avoid an IE6 bug (keep this line on top of the page)
$login='NO data sent';
/*simple checking of the data*/
if(isset($_POST['login']) && isset($_POST['pass']))
{
/*Connection to database logindb using your login name and password*/
$db=mysql_connect('localhost','userid','password') or die(mysql_error());
mysql_select_db('dentalpartner');
/*additional data checking and striping*/
$_POST['login']=mysql_real_escape_string(strip_tags(trim($_POST['login'])));
$_POST['pass']=mysql_real_escape_string(strip_tags(trim($_POST['pass'])));
$q=mysql_query("SELECT * FROM login WHERE user_id='{$_POST['login']}' AND login_pasword='{$_POST['pass']}'",$db) or die(mysql_error());
/*If there is a matching row*/
if(mysql_num_rows($q) > 0)
{
$_SESSION['login'] = $_POST['login'];
$login='Welcome back '.$_SESSION['login'];
}
else
{
$login= 'Wrong login or password';
}
mysql_close($db);
}
//you may echo the data anywhere in the file
echo $login;
?>
then my result come out:
The website encountered an error while retrieving http://localhost/php/login.php. It may be down for maintenance or configured incorrectly.
thanks in advance
jeff