WordPress Plugin: The School Management – Education & Learning Management

I am trying to save a student's record in the database. There are two fields (Class, Section) that were mandatory before, and because they were mandatory, so I had to select a value for both fields. The student’s record was saved in the database. But as per the requirement, I don’t need the fields to be mandatory. That’s why I made them non-mandatory fields.

But now the problem is if I leave the class and section fields empty the student record is not saved in the database. After submitting the message appears as:

But if I check the database the student is not saved.

Can someone explain what the problem might be?

    Just guessing that the relevant DB table columns are defined as not null in the database, but that's only a guess without seeing actual error logs/messages.

      14 days later

      If you want to store data in a database, you need to be careful about whether you are inserting new data or updating existing data. This can be a chore, and often involves a query first to check for an existing record. Two fields (class, section) doesn't sound very useful because there's no student id.

        Write a Reply...