-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcategories.php
39 lines (35 loc) · 1.16 KB
/
categories.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
include_once('./includes/common.functions.php');
include_once('./appsfilter.php');
?>
<div id="categoriesBar">
<p class="text-center"><span class="label label-primary label-main">Categories</span></p>
<table class="table table-condensed">
<?php
$sql="SELECT * FROM categories WHERE catParent IS NULL";
$result=$mysqli->query($sql)or die("query failed due to ".mysqli_error());
while($row=$result->fetch_assoc())
{
if(isset($_SESSION['mCat']) &&$_SESSION['mCat']==$row['catID'] )
{
echo '<tr><td><a href="?mc='.$row['catID'].'">'.$row['catName'].'</a>';
$sql2="SELECT * FROM categories WHERE catParent ={$_SESSION['mCat']}";
$result2=$mysqli->query($sql2)or die("query failed due to ".mysqli_error());
if($result2->num_rows != 0)
{
echo '<ul>';
while($row2=$result2->fetch_assoc())
{
echo '<li><a href="?sc='.$row2['catID'].'">'.$row2['catName'].'</a></li>';
}
echo '</ul></td></tr>';
}
}
else
{
echo '<tr><td><a href="?mc='.$row['catID'].'">'.$row['catName'].'</a></td></tr>';
}
}
?>
</table>
</div>