Create SQL queries for getting marks (Moodle 2.62)

Re: Create SQL queries for getting marks (Moodle 2.62)

by Kathir Rajaraman -
Number of replies: 0

Hi Sebastain

$sql = 'Your Sql Query';

You will fetch the single record from database below the code you will use,
$result
= $DB->get_record_sql($sql);

or
You will fetch the multiple records from database below the code you will use,

$results = $DB->get_records_sql($sql);

For Example,
$sql = 'SELECT * FROM mdl_user';
$result = $DB->get_record_sql($sql);

Thanks
Kathir