I'm getting an error as i'm trying to create a login page which will allow users to be directed to the right page. e.g a student will be directed to the student page and the staff will be directed to the staff page but i don't know whats wrong with my code..help
<?php
ob_start();
$host="localhost"; // Host name
$username="amy"; // Mysql username
$password="annie"; // Mysql password
$db_name="pa"; // Database name
$tbl_name="user"; // Table name
// Get info from the session
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// Define $myusername and $mypassword and $myusertype
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
$myusertype=$_POST['myusertype'];
//$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and //password='$mypassword'";
//$result=mysql_query($sql);
$sql=("SELECT user_type FROM $tbl_name WHERE username='$myusername' and password='$mypassword' and user_type ='$myusertype'");
//$result2=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result2);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1 ){
Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("myusername");
session_register("mypassword");
session_register("myusertype");
header("location:login_success.php");
}
else {
echo "Wrong Username or Password";
}
//ob_end_flush();
?>
this is the error message
Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\capat\checklogin.php on line 34