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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.