I have created a report and am using tablelib to display the values. As per the doc, columns and headers are defined. However, I am getting the below error:
Did you remember to make the first column something unique in your call to get_records? Duplicate value '4' found in column 'unid'.
- line 1282 of \lib\dml\mysqli_native_moodle_database.php: call to debugging()
- line 2069 of \lib\tablelib.php: call to mysqli_native_moodle_database->get_records_sql()
- line 2091 of \lib\tablelib.php: call to table_sql->query_db()
- line 76 of \local\myreport\index.php: call to table_sql->out()
I have tried adding different IDs. Unfortunately, I am not able to resolve the error.
I have managed to resolve the above issue by adding RAND(1) AS'unid' as the first column but I got duplicate values in the table.
The following are the tables I have used :
Can someone please suggest how to get the unique ID?
Moodle version 3.11+
Thanks in Advance