Hi again,
Now I'm trying to get some values from my block's database. I tested it with phpmyadmin and it works well, the query it's something like this:
SELECT cm.id, wf.hoursperday
FROM ...blablabla... wf
JOIN ...... cm
...
I get two elements:
id-> 9 hoursperday -> 0.56
id-> 11 hoursperday-> 1.14
I do the same query inside moodle, using the $DB->get_record_sql($sql, $params); method
But on this case I only get one element
id-> 9 hoursperday-> 0.56
I have read that the get_record_sql() method uses the first field as a key, therefore it overwrites the content if a new key matches an already existent key.
Knowing that, I tried to use the cm.id variable, which is a unique key for every element, but it seems it's not working right since I'm getting just the first element
Am I doing something wrong? Is there any other method better for what I want?
Thank you all, and of course, merry christmas!