I have some PHP codes and a database.
view_subjects.php
' and ' view_tests.php
' respectively using SELECT * ..
CREATE VIEW II AS SELECT * subjects WHERE semester='II';
And Views I, III, IV respectively. Edit- Realised that it is not necessary. SELECT * FROM [viewname]
on step 3. Eg: SELECT * FROM [I] , SELECT * FROM [II], ... SELECT * FROM [IV]
Is my approach correct?
If so, how can I get the semester name after if he/she logs in Otherwise, how should I approach this problem?
Edit My problem is to add a filter. I want users to see their subjects and tests based on the semesters they are in. Semester is an attribute of the student table along with roll_no and password.
I hope this makes sense, Im not going to write code as i dont know what you are working with there, but for situation like this, Following will be the basic idea.
Method one(i do not prefer this)
Add a current_semester field in student table, where you store semester id. This is to be updated every time a student completes a semester.
before loading your information page, save the value of current_semester in a variable, and use something like, "SELECT * FROM [semester table] WHERE id = [current_semester]"
This will give you the current semester of his/her semester where ever you want but it will not save his semester history.
Advised Method(using different table to save student's semester history)
Advise: Use Laravel, Eloquent makes this sort of work extremely easier.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.