Welcome Guest, Not a member yet? Register   Sign In
Database Interaction help
#1

[eluser]Kahlil Isaac[/eluser]
Hello Everyone,

I need some help and guidance advice.

I am a student that has alot of interest in software engineering and programming but i am so much of a novice. I recently did a school project http://insy211d.tntcoders.com it is a simple school management system i got an A grade.

I did it using basic procedural php scripting. I heard about MVC design pattern and wanted to try my hand at rewriting this app using this pattern and well a fried recommended that i use CI as it was one of the easiest framework to use and simple for beginners. However while looking at some tutorials they all talk about using a model for each database which i understand why but when it comes to relationships and joins i am not finding anything about that.

Code:
SELECT student.f_name,student.l_name,grade.student_id,grade.enrollment_yr,grade.enrollment_term,grade.gradepoint,SUM(course_credit), SUM(gradepoint),course.course_credit, course.course_title
FROM grade
INNER JOIN course ON grade.course_id = course.idcourse
LEFT JOIN student
ON grade.student_id=student.idstudent
WHERE student_id='$loggedinstudent' AND enrollment_yr='$year' AND enrollment_term='$term'
GROUP BY enrollment_term"


I would like to know if anyone can suggest or give me advice on this. Should i make a model to handle the relationships too or should i try doing relationships in the controllers?

Any help advice would be grateful
Thank you
#2

[eluser]Madoc[/eluser]
I am not quite sure to understand what you are actually asking but I suggest you read a bit about the MVC framework.

I am also pretty new at this but the basic idea is that:
- your Models handles any database access. You can create as many models as your want, good practice would probably be along the lines of creating a different model for each "entity" you have on your system but it is really up to you !
- your Views handles the display of any data you give to them.
- your Controllers handle the logic of your application. This is where for instance you will call a model function to get some data and once processed, give it to your view for display.

Hope this helps some...




Theme © iAndrew 2016 - Forum software by © MyBB