用php显示mysqli的值

Here is my code:

http://pastebin.com/husbQ7hc

On line 33 it has:

echo $value;

How can I have it that I can use it like below:

echo $value['module_name'];
echo $value['module_name_id'];
echo $value['module_image'];

Hope someone can help.

Thanks

During your final result fetch on line 13:

// Retrieve results
while ($row = $result->fetch_assoc()) {
    // Add to final array via counter if valid course is found
    if (in_array($row['course_name'], $courses)) {
            $final[$row['course_name']][] = $row['module_name'];
    }
}

Rather than storing just the column value of $row['module_name'], store the entire row to access it later:

$final[$row['course_name']][] = $row;

Then when you "loop through the internal values" on line 32 you can access any column you want using:

echo $value['module_name'];
echo $value['module_name_id'];
echo $value['module_image'];