this is my php to redirect my users into their profile page.
Ive got an userlogin table in database.
their also usercategory field in that table.
its saying an error22527.
<?php
include'connection.php';
/* this function is to sanitze values recevied from form.*/
function clean ($str) {
$str = @trim($str);
if(get_magic_quotes_gpc())
{
$str = stripslashes($str);
}
return mysql_real_escape_string($str);
}
$username = clean ( $POST['email']);
$password = clean (md5($POST['password']));
$result = mysql_query("SELECT * FROM tbluser_login WHERE user_Email='".$username."' AND user_Password='".$password."'");
$result2 = mysql_query("SELECT user_Category FROM tbluser_login WHERE user_Email='".$username."'");
/$result3 = mysql_fetch_row($result2);/
print_r(mysql_fetch_row($result2));
if ($result){
if(mysql_num_rows($result)== 1 ){
session_regenerate_id();
$login = mysql_fetch_assoc($result);
$_SESSION['SESS_username']= $login['user_Email'];
$_SESSION['SESS_usercategory'] = $login['user_Category'];
$_SESSION['SESS_pasword'] = $login['user_Password'];
session_write_close();
switch($result3[0]){
case 'Tutor':
header("location: tutor_profile.php");
break;
case 'Staff':
header("location: staff_profile.php");
break;
case 'Student':
header("location: student_profile.php");
break;
case 'Administrator':
header("location: admin_profile.php");
break;
default: die("case not working");
}
}
else {
echo("error".error_reporting(E_ALL));
exit;
}
}
?>