Users won't be enrolled - Multiple records found, only one record expected

Users won't be enrolled - Multiple records found, only one record expected

by Hammed Lawal -
Number of replies: 0

When a user makes payment online, he is meant to be auto enrolled to the selected course. The payment would be successful but would not be enrolled to the course. It has been working perfectly for over 3 months of upgrading to 3.2.1.

We tested that same plugin for a new site set up with stable version 3.2.2 and it worked perfectly fine. So, we tried to upgrade to that same version but the error still occurred.

Kindly help. Thank you in advance.

Below are the error logs

Multiple records found, only one record expected.

Debug info: SELECT * FROM {enrol} WHERE courseid = ? AND enrol = ?
[array (
0 => '98',
1 => 'interswitch',
)]
Error code: multiplerecordsfound

Stack trace:

    line 1561 of /lib/dml/moodle_database.php: dml_multiple_records_exception thrown
    line 1523 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
    line 1502 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
    line 259 of /enrol/interswitch/return.php: call to moodle_database->get_record()

Average of ratings: -