Hello forum Members,
Somebody help me please.
I want to learn how to write and execute mysql code and query in moodle version 2.5. Can someone direct me to some resources or explain how to do this to me, please?
I am good at using and writing sql on its own. Now, what I do not know how to do is how to write mysql and execute it within the moodle environment.
How do you normally write, execute and view your sql queries in moodle, please?
For example, in a database, if I have a table for user and want to show the results, I could use a code like the one below (I copied it from somewhere), But where and how to I execute it?
$user = $DB->get_record_sql('SELECT * FROM {user} WHERE id = ?', array(1));
I will appreciate your help.
Thanks.