0

I'm new to moodle and I built a plugin that is supposed to fetch data from a database and display it. I can't reach the data from my database, it's not displaying the info that I want.

This is my file, what am I doing wrong?

           <?php
           // This file is part of Moodle Course Rollover Plugin
           //
           // Moodle is free software: you can redistribute it and/or modify
           // it under the terms of the GNU General Public License as published by
           // the Free Software Foundation, either version 3 of the License, or
           // (at your option) any later version.
          //
           // Moodle is distributed in the hope that it will be useful,
           // but WITHOUT ANY WARRANTY; without even the implied warranty of
           // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
           // GNU General Public License for more details. 
           //
           // You should have received a copy of the GNU General Public License
           // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

           /**
            * @package     admin_report
            * @author      #####
            * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
            */

            function get_infos_from_db() {
              global $DB;
              $sql = " SELECT *
                       FROM mdl_bigbluebuttonbn

                     ";
              var_dump($sql);
              // $DB->get_record_sql($sql, array $params=null, $strictness=IGNORE_MISSING);
            }

1 Answers1

0
$records = $DB->get_records('bigbluebuttonbn');
foreach ($records as $record) {
    echo $record->xx;
}
Russell England
  • 9,436
  • 1
  • 27
  • 41