Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9013863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:22:25+00:00 2026-06-16T03:22:25+00:00

I was using a registration form for teachers and one for students. There are

  • 0

I was using a registration form for teachers and one for students. There are ten fields in each, first name, last name, username, password, etc being similar whereas departments (teachers have 7, students have 3) and email ids (teachers have a different domain extension and students different) being different. I am using two tables, one for teachers and one for student.

Now, I know I can use one login form, query against these two tables using the JOIN property and make them login. But I want to know if this method is efficient because two tables are being used.

Or is this method more efficient: In the reg form, I put a radio button to select teacher or student and depending on what one chooses the remaining fields change, i.e, if I choose teacher, 7 departments show up or if I choose student only 3 of them show up. In this way, I have to use one table only, atleast I guess so.

Or another possibility is I use two tables but two login forms, one for teacher and one for student, I know this is the easy way out but being a Comp Sci student I want to choose the efficient method of all.

P.S: The teacher’s role is going to be completely different from the student’s in the site. And there will be lot of activities for the teachers and students, they are completely different. Will maintaining one table be a good bet?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T03:22:26+00:00Added an answer on June 16, 2026 at 3:22 am

    I would say that both teachers and students are users, but teachers have higher privileges, much like an administrator.

    As such, I would only use 1 table for users and have an attribute column to indicate what type they are.

    Once they login, you can return a type variable to your page to determine what fields to display.

    And you really don’t even need a radio button to indicate the type. Just have a username and password field. Then once they are authenticated, retrieve the type attribute and load your form accordingly.

    Your PHP page might look like this:

    <?php
        if(isset($_POST['username'])) {
            $user = $_POST['username'];
            $password = $_POST['password'];
            $mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_db');
    
            $query = "SELECT * FROM tblUser WHERE userid=" . $user;
    
            //Execute SQL
            if($mysqli->query($query) === TRUE) {
                if ($password == $row['password']) {
                    $userType = $row['type'];
                    $mysqli->close();
                    echo $userType;
                else { echo "incorrect password"; }
    
            } else { echo "SQL execution error"; }
        } else { 
            echo "invalid username string"; 
        }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Django-Registration and the form just has 3 fields (Username, Email, Password, and
I am creating an user registration form using jsp,in which there is an option
how to secure my password in my registration form using salt and hash technique?
I'm trying to create a registration form and validate input fields using javascript, but
I have created a user registration form using PHP, a password must be entered
I am using struts2 for my web application development. In a registration form there
I'm creating a registration form. The user enters the username and password, and presses
I am creating a registration form using PHP and jquery with ajax. Each field
I am using django-registration for my project. in my registration_form.html file: {{form.username}} {{form.email}} //other
I'm trying to validate my registration form. I'm using djanga-registration, it already has password

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.