General developer forum

Category Names using PHP

 
Picture of Ryan Carpenter
Re: Category Names using PHP
 

I found this post, which worked for me.

<?php
global $DB;
$category = $DB->get_record('course_categories',array('id'=>$COURSE->category));
echo $category->name     
?>

Edit: I initially thought this wasn't working, but that was only due to displaying it incorrectly.

 
Average of ratings: -