Skip to content
Advertisement

User Redirection accordingly an enum input. PHP code

I’m trying to redirect the logged-in user to a different page according to the enum input was stored at db.

I was trying those lines, but it always redirects me at pro.php. How can I do this with the right way? What is the issue with the code?

Here is my table definition:

# Name Type Null Default
1 id Primary int(11) No None AUTO_INCREMENT
2 firstName varchar(255) Yes NULL
3 lastName varchar(255) Yes NULL
4 email Index varchar(255) Yes NULL
5 speciality enum(‘pro’, ‘stu’) Yes NULL
6 password varchar(100) Yes NULL
7 lastLogin timestamp Yes NULL

Here is the PHP code:

JavaScript

I know the user is logged in because after the login, i’m going to db and see the lastLogin updated at the current user.

Advertisement

Answer

Ok i change the speciality type enum to int(0 or 1) and some more things to the code and now is redirect me properly and almost everything working properly.

JavaScript

}

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement