Hello everybody
Sorry for my English, but it is not very well.
Can anyone help me to find in which table in moodle 1.8+ are store the relationship between user and the course where the user is belong.
I need this because i want to check which user in which course belong directly with sql query.
Thanks
mdl_role_assignments and mdl_context
Something like
Something like
SELECT * FROM mdl_user u, mdl_role_assignments ra, mdl_context con, mdl_course c, mdl_role r WHERE u.id = ra.userid AND ra.contextid = con.id AND con.level = 50 AND con.instanceid = c.id AND ra.roleid = r.id AND r.shortname = 'student'
I think it should be "con.contextlevel" instead of "con.level" on the 3rd line of the where clause.
I think that will help me, but i have one question what is store in mdl_context table. Because before i take the course which student belong from mdl_course_display, but when one student visit some course more than one times there was record more than one row with userid and courseid.
And I make new user and enroll him in some course. There is no record in table mdl_course_display untill the user visit that course.
And I make new user and enroll him in some course. There is no record in table mdl_course_display untill the user visit that course.
To understand tese concepts, you need to read http://docs.moodle.org/en/Roles_and_capabilities
Sorry for asking again, but i can't understand how can write an sql query to take courses where some user belong to when I have his id.
I want to make somthing like this.
There is many teachers an every teacher have own course (may have more than one course). I can take his id, name, but i don't know how i can take only the course/courses that manage (course id, shortname, fullname).
There is and many student that belong to some courses. But I don't know how to take the course id, shortname, fullname of the courses that user belong when i heve his id.
The idea is when some student take test in external database is saved his result.
Then when some teacher log into my system, I take his id and when he go to view the results from tested students to view only the results ot students that belong to his course. To do that i have to know the course/courses managed by the teachers and the courses that students belong to.
Thanks
P.S.: I hope to understand what i am trying to tell you.
I want to make somthing like this.
There is many teachers an every teacher have own course (may have more than one course). I can take his id, name, but i don't know how i can take only the course/courses that manage (course id, shortname, fullname).
There is and many student that belong to some courses. But I don't know how to take the course id, shortname, fullname of the courses that user belong when i heve his id.
The idea is when some student take test in external database is saved his result.
Then when some teacher log into my system, I take his id and when he go to view the results from tested students to view only the results ot students that belong to his course. To do that i have to know the course/courses managed by the teachers and the courses that students belong to.
Thanks
P.S.: I hope to understand what i am trying to tell you.
hello everybody, i need help, i need some SQL query that takes teacher names and students names from one course.
Example
course name, teachers names , student names, startdate
Examplecourse, nyamdavaa, ayush jonh , mary, smith 03\01\2009
is there any body can help me
Example
course name, teachers names , student names, startdate
Examplecourse, nyamdavaa, ayush jonh , mary, smith 03\01\2009
is there any body can help me