guys i need some help!.. my friends are having their project on web developing??

How can i create a Login System with this database??

tbl_stud
st_uname = logmein
st_pw = 123
type_id = student

tbl_prof
pr_uname = pro
pr_pw = 321
type_id = prof

tbl_admin
ad_uname = adm
ad_pw = 890
type_id = admin

tbl_Utype
type_id = admin,prof,student
type_num = 1,2,3

i really need some help on how to create login system on their web site with that database..

what query should i need to put??

please?? need some help..

Create login form for using via web page (can be both HTML and PHP). Pass the data from that form to the login script and check if the user input data are already exists in the database, i.e., the username and password does not match or not.

You can learn many tutorials of login/out system on the internet. Google yourself.

Connect the database useing mysql_connect(), select the database using mysql_select_db(), query the database with the username and password entered by user
EG: mysql_query("SELECT * FROM `tbl_stud` WHERE `st_uname` = '$username' AND `st_pw` = '$password'"); where $username and $password is data collected from login fields username and password respectively.. get the count of record from db with mysql_num_rows() if it is 0 it means no existing user. if it is 1 or > 1 that means user existed in the db

if you have any query ask here ! hope it will helps you ! happy developing

Trying this simple login form

<?php
session_start();
//db connection
$nameserv = "localhost";
$username = "root";
$pass = "";
$dbname = "daniweb";
$conn = mysql_connect($nameserv,$username,$pass)or die(mysql_error());
$selectdb = mysql_select_db($dbname, $conn);

$login = $_POST['login'];
if(isset($login)){
	$usrname = $_POST['username'];
	$password = $_POST['password'];
	$upass	= MD5($password);
	//validate input
	if(empty($usrname)){
		$msg = "Empty Username!<br />";
		$a = 1;
	}
	if(empty($password)){
		$msg .= "Empty Password!<br />";
		$a = 1;
	}
	if($a != 1){
		$sql = "SELECT *FROM login WHERE username = '".$usrname."' AND password = '".$upass."'";
		$exec = mysql_query ($sql, $conn);
		$count = mysql_num_rows($exec);
		$data_login = mysql_fetch_array($exec);
		echo mysql_error();
		if($count == 0){
			$msg .= "Login failed!";
		}else{
			session_register ($usrname);
			$_SESSION['user'] = $usrname;
			$msg .= "<span style='color : #0000FF'>Login Success!</span>";
		}
	}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Login Form</title>
</head>
<body>
<h2>Login Form Example</h2>
<div style="margin : 10px; font-style : italic; color : #FF0000"><?php echo $msg;?></div>
<form method="POST" action="<?php $_SERVER['PHP_SELF'];?>">
<table>
	<tr>
		<td>Username</td>
		<td>:</td>
		<td><input type="text" name="username" value="<?php echo $usrname;?>" /></td>
	</tr>
	<tr>
		<td>Password</td>
		<td>:</td>
		<td><input type="password" name="password" /></td>
	</tr>
	<tr>
		<td></td><td></td><td>
		<input type="submit" name="login" class="button" value="Login" />
		</td>
	</tr>
</table>
</form>
</body>
</html>

or download the complete source code and its database in http://www.leakbali.com/script/20/php-login/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.