0

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..

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by dean8710
0

hope you can modify from below code, by type...

//take student table
$student = $_POST;
$password = $_POST;
$type = $_POST;

//connect to db
$connection = mysql_connect("$localhost", "root", "");

//check connection
if(!$connection)
echo die(mysql_error());
else
echo "Connected";

//select database
mysql_select_db("my_db", "$connection");

//query
$sql_login = mysql_query(SELECT * FROM tbl_stud where username = $username and password = $password);

//check either the username is existed or not
//equal to 1 if existed (true)
//successful
$count = mysql_num_rows($result);
if($count == 1)
{
session_register("$username");
session_register("$password");
header("location: welcome.html");
}
else //failed
{
header("location: login.html");
}

Edited by dean8710: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.