Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have two tables .. one table is for citizen and one table is for staton.. i have one loginin page having fields for username and password. if citizen logs in he will go to his page. and if station logs in he goes to his page..

as table for citizen and stations are different . so login and password for citizen and station users are in diffent tables.

how to query so that that system will check the login in and password for citizen or station to redirect them to there pages.

how to use select query for that..
Posted

Try keeping usernames/passwords of both types of users in one table. And in that table, add a flag column to determine the user type. Then you have to only query one table.
 
Share this answer
 
Comments
codegeekalpha 20-Feb-12 5:40am    
how can i put username passwords of both the types in one table.. they have different other attributes.
krumia 20-Feb-12 6:32am    
Let the different attributes of citizen and station be in two tables... but you can get the authentication stuff (i.e. username/password) into one table. and in that table you can have a flag so you can query the correct table for their attributes.
well its not really a query's job. A sql query will do something like check the password supplied against a stored password for a username.

But it (sql) wont be able to tell the browser to redirect to one page or another. It will just get data. (in your particular case)

Any redirection would have to be done in say asp.net

cheers

Bryce
 
Share this answer
 
Hey,
keep usernames/passwords of all users in one table and add 1 extra column to determine what type of user that is like if admin then super and if simple user then user or whatever that is.
when user going log in then check UserName and password and what type of user that is and maintain session for that type of user and finally check session value at page load if appropriate user then show page otherwise redirect to login page.
Best Luck.
 
Share this answer
 
Comments
codegeekalpha 20-Feb-12 5:50am    
how can i put username passwords of both the types in one table.. they have different other attributes.
Put a Dropdownlist control to select User Type ("citizen" or "station") at
Login page. Further query would be according to the User Type selection.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900