
False boolean is returned if the requested record is not found.
IGNORE_MISSING - In this mode, a missing record is not an error. An exception will be thrown if no record is found or multiple matching records are found. MUST_EXIST - In this mode, the requested record must exist and must be unique. Supported modes are specified using the constants: Some methods accept the $strictness parameter affecting the method behaviour. $DB -> get_record_sql ( 'SELECT * FROM WHERE firstname = :firstname AND lastname = :lastname', ) Strictness
Example of using question mark placeholders. The DB object is available in the global scope right after including the config.php file:.as a part of including the main config.php file.
It is instantiated automatically during the bootstrap setup, i.e. The $DB global object is an instance of the moodle_database class.Moodle core takes care of setting up the connection to the database according to values specified in the main config.php file.The data manipulation API is exposed via public methods of the $DB object.
8 Getting field values from multiple records. 7 Getting a particular field value from one record. 5 Counting records that match the given criteria. 4 Getting data as key/value pairs in an associative array.