using moodle built in function how add data in new table

using moodle built in function how add data in new table

by prashant galagali -
Number of replies: 0
if (strstr($element, '.cmi.core.lesson_status')) {
       $scormstatus = get_record('scorm_scoes_track', 'id', $value);
   
   
    }
    print_r($scormstatus);
   
    if(strstr($element,'cmi.core.score.raw')){
    $score=get_record('scorm_scoes_track', 'id', $value);
    }
   
    $track1= $scormstatus->scormstatus;
    $track1=$score->score;
    $track1=$USER->username;
    $track1->userid = $userid;
       $track1=get_record('Scorm','id',$scorm->name);
 
        $track1->scoid = $scoid;
        $track1->attempt = $attempt;
        $track1->element = $element;
        $track1->value = addslashes($value);
        $track1->timemodified = time();
   
   // $track1=array('userid','scormid','username','scormname','attempt','timemodified','score','scormstatus');
    //errorlog($track1);
    $id=insert_record('grade_report',$track1);
Average of ratings: -