I thought this rather peculiar. I have the following sql command:
SELECT element FROM mdl_scorm_scoes_track WHERE scoid =4 ORDER BY element ASC LIMIT 0 , 100
which returns a column of values when run from phpmyadmin. But this code doesnt work:
$elements = get_records_sql("SELECT element FROM mdl_scorm_scoes_track WHERE scoid =4 ORDER BY element ASC LIMIT 0 , 100");
I tested by printing $elements in a table later in my code. However, if I change it to
$elements = get_records_sql("SELECT id, element FROM mdl_scorm_scoes_track WHERE scoid =4 ORDER BY element ASC LIMIT 0 , 100");
Then printing $elements gives me an Array. Adding a foreach loop i can see all the results and I know that it works fine. If I change the id to another field, for eg. scoid it returns something but not all records (in fact, for my db, only 1 record). Any idea????