Jump to content

how do i list my sub cats like this?


$php_mysql$

Recommended Posts

friends i got my subcats stores like this

 

subcat_id subcat_name id_cat

1                      name              1

 

 

and i fetch them like this

 

 

function getAllSubcategoryWithPrimaryCategory() {         $subcategories = array();        $sql =" SELECT c.cat_name, sc.id_subcat, sc.subcat_name                FROM `categories` AS c                INNER JOIN subcategories AS sc ON c.id_cat = sc.id_cat order by c.cat_name asc , sc.subcat_name                ";        $rs = executeSql($sql);        while($row = mysql_fetch_array($rs)) {            $subcategories[] = $row;        }        return $subcategories;    }

 

 

now the thing is i have stored names like

 

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

p

q

other category

 

but results are like this

 

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

other category

p

q

 

Acending ways but i wish for the other category to show at the end of every subcategorym how could i get that done?

Link to comment
https://forums.phpfreaks.com/topic/215325-how-do-i-list-my-sub-cats-like-this/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.