Posts made by Martin Dougiamas

Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Ah, I see.

If you look at insert_record() you'll see that the id is obtained via a SELECT right at the end (because this is most reliable way I could find that works on any database).

However, if you have a table that contains:

id   name    comment
1    aaa     bbb
2    aaa     bbb
3    aaa     bbb
where multiple records are exactly the same, then the SELECT may grab another one and thus return the wrong ID.

The simple fix in this case is to add a field with a unique code of some sort, like a timestamp. I always use time(). Timestamps are very useful anyway when reconstructing logs etc.

Cheers!
Martin

Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Not that I know of, but I doubt anyone's integrated a pay system yet.

Currently the authentication methods aren't linked to course enrolments (only site accounts), but one way I could see this working is to have the concept of site "credits".

If credits were enabled (by the admin) then there could be an authentication method which somehow allowed students to add credits to their account, and enrolling in any course would remove credits from the student's account.