I'm trying to pull off the largest index for a particular group (the $user_id's each have several $course_id's associated with them). I'm using the following PHP/SQL to get the info from my database:

PHP Code:
function getlastCourseTaught($read,$user_id) {
$sql "SELECT MAX(course_id)
            FROM courses
            WHERE user_id = 

The code works but I'm having problems getting at the actual ID. When I print_r my results, I get:

Array ( [0] => Array ( [MAX(course_id)] => 1 ) )

So, two questions:
1) Why is SQL giving me back an array? Doesn't the MAX just return one specific number?
2) How can I untangle the "array within the array" to get at the MAX(course_id) of "1".


PS IF this thread is more of a PHP question, please move it by all means.