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,
It is critical to use prepared statements when dealing directly with user supplied data from a webpage like username and password.
Your present code is open to SQL injection. Use mysqli with prepared statements, or PDO with prepared statements.
From Fred: PHP Not Inserting Content in mySQL Database: Text, Images, Anything