you have created your table correctly.now you want to input records into that table.first ill tell you the concept of login,logout and register processes.
when a user tries to login to your site you must check that there is a match with the database data and the user input data.if the password and username matches you allow him to login.
there for the first step is you must allow users to register.assume there is a simple html page with a form for that.
(create separate files for code which separated from ####### marks,save files with the given extention)
########form.html########
<html>
<body>
<form action="register.php" method="post">
<input type="text" name="username" id="username">
<input type="password" name="pw" id="pw">
<input type="text" name="fname" id="fname">
<input type="text" name="email" id="email">
<input type="submit">
</form>
</body>
</html>
#######register.php######
<?php
mysql_connect("your_host_name","your_username","your_password");
mysql_select_db("your_database_name");
mysql_query("INSERT INTO dbusers(name,username,password,email) VALUES('$_POST[fname]','$_POST[username]','$_POST[pw]','$_POST[email]')") or die("cannot execute the query");
echo "user registered";
?>
registration process is finished.now you should create a login form.
######loginform.html######
<html>
<body>
<form action="login.php" method="post">
<input type="text" name="username" id="username">
<input type="password" name="pw" id="pw">
<input type="submit">
</form>
</body>
</html>
when you click on the submit button following login script will run
######login.php#######
<?php
mysql_connect("your_host_name","your_username","your_password");
mysql_select_db("your_database_name");
$myusername=$_POST['username'];
$mypassword=$_POST['pw'];
// To protect MySQL injection (more detail about MySQL injection)
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$mysql = "SELECT * FROM dbusers WHERE username='$myusername' and password='$mypassword' ";
$result = mysql_query($mysql) or die("cannot execute query");
$count = mysql_num_rows($result);
if($count==1)
{
session_register('username');
header("location:home.php"); // put your home page neme here
}
else
echo "login fail";
?>
]
#####logout.php#####
<?php
session_start();
session_destroy();
echo "successfuly logout";
?>
use this code at the top of your home page to obtain session variable
<?php
session_start();
$username = $_SESSION['username'];
?>
now you can use "$username" variable to display username of the logged in user.
ex.
<?php
echo "you logged in as ".$username;
?>
thats all