I am trying to print a list something like this....
Catagory 01
subjects1 subjects4
subjects2 subjects5
subjects3 subjects6
Catagory 02
subjects1 subjects4
subjects2 subjects5
subjects3 subjects6
Catagory 03
subjects1 subjects4
subjects2 subjects5
subjects3 subjects6
One category has its own subjects. At the moment I have the category id and created a query to get its category name and its owned subjects. this is the query that I have created..
[code=html][code=php]
$categoryIds = implode(',', $_SESSION['category']);
$q = "SELECT c. category_id AS ci, c.category_name AS cn, s.subject_name AS sn, s.subject_id AS si
FROM category AS c
INNER JOIN category_subjects AS cs ON cs.category_id = c.category_id
INNER JOIN subjects AS s ON s.subject_id = cs.subject_id
WHERE c.category_id IN ($categoryIds)";
[/code][/CODE]
$r = mysqli_query( $dbc, $q) ;
Above query gives every categories and it own subjects. Its like a multidimensional array. My problem is I tried to print this date something like above list... But can not get it to work..
Is there someone to help me to this? Your ideas and comments are greatly appreciated.
Thank you.