I have following code (php and jquery) for Login for Student and Teacher (using same form for both access). In my system the admin can create Student and Teacher. Once created,
I think the problem is here;
if( $count_stu > 0 ) {
//$_SESSION['id']=$row_student['student_id'];// mistake
$_SESSION['id']=$row_stu['student_id'];
echo 'true';
}else if( $count_tea > 0 ) {
//$_SESSION['id']=$row_teacher['teacher_id'];// mistake
$_SESSION['id']=$row_tea['teacher_id'];
echo 'true_teacher';
}
else{
echo 'Wrong Username Or Password';
}
I agree with @Drew Pierce, you should consider using pdo or mysqli.