Good day,
I am trying to make a custom dashboard on moodle to see how many users have viewed a page. (I am new to PHP so pls bare with me)
My SQL comand works fine in PHP my admin, and it works in my PHP file,
but when I view it I only see the following:
stdClass Object ( [count(id)] => 108 )
I only want the 108 .... to put in a table
I tried:
$test = get_object_vars($countVisits);
echo $test . "<br><br>";
$countVisits[0]; gives me an error,
$countVisits->count(id); comes out blank
thanks!
--- CODE ---
$sql = "SELECT COUNT(id) FROM `m_logstore_standard_log` WHERE `courseid` = 98 AND (`timecreated` Between $startDateU AND $endDateU) AND (`contextinstanceid` = 399 OR `contextinstanceid` = 397) AND `action` = 'viewed';";
$countVisits = $DB->get_record_sql($sql, null);
print_object($countVisits);