Hi,
I am trying to pull out categories and sub categories. I have the following 2 methods:
public function selectAllCategories(){
$query = "SELECT * FROM tbl_category WHERE deleted = 0
ORDER BY date_added DESC";
$result = mysql_query($query);
return $result;
}
public function selectAllSubCategories(){
$query = "SELECT s.ID as TheID,
s.name as TheName,
s.category_ID,
s.date_added,
c.name
FROM tbl_subcategory s
INNER JOIN tbl_category c
ON s.category_ID = c.ID
WHERE s.deleted = 0 AND c.deleted = 0
ORDER BY s.date_added DESC";
$result = mysql_query($query);
return $result;
}
But i see this:
http://www.freemanholland.com/cow/public_html/images/category.jpg
I have 2 categories in the table tbl_category, called Mens & Ladies, then i have a series of sub categories in each.
But as you can see in the image the subcategories show in pairs? why is this?
The select statement being used for this is selectAllSubCategories, as shown in my methods…
Can anyone help?
Thanks