showing links alphabatically ordered
Moderator: General Moderators
-
crazytopu
- Forum Contributor
- Posts: 259
- Joined: Fri Nov 07, 2003 12:43 pm
- Location: London, UK
- Contact:
showing links alphabatically ordered
A quick question:
My admin user (who is a completely non-tech person) is now able to insert a new link and a number of sublink under the link. My management now wants that insead of order by the sublink with sublink_id, i rather arrange their order alphabatically.
I wonder is there any php built-in function that i can use?
My admin user (who is a completely non-tech person) is now able to insert a new link and a number of sublink under the link. My management now wants that insead of order by the sublink with sublink_id, i rather arrange their order alphabatically.
I wonder is there any php built-in function that i can use?
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
You are pulling these links from a database?
Just modify your query a bit..
Just modify your query a bit..
Code: Select all
.. ORDER BY `sublink_id`-
crazytopu
- Forum Contributor
- Posts: 259
- Joined: Fri Nov 07, 2003 12:43 pm
- Location: London, UK
- Contact:
yes, i m drawing all my links and sublinks from the database. The thing is, so far i did order their sublink_id. So, i wrote something like
Code: Select all
order by sublink_id desc;
That way, the most recent sublink were appearing at the bottom of the sublink list. But management wants that they dont want the most recent ones go at the bottom of the list, rather they want that the list is arranged alphabatically. Which i understand can't be done using a sql query alone.- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Code: Select all
.. ORDER BY `sublink_id` DESCCode: Select all
.. ORDER BY `sublink_id` ASC-
crazytopu
- Forum Contributor
- Posts: 259
- Joined: Fri Nov 07, 2003 12:43 pm
- Location: London, UK
- Contact:
do u understand what I am trying to say? I want to arrange all those sublinks (their title to be more precise, upon clicking which u get the body of that sublink in a separate page).
Now, i want this sublink title to be displayed alphatebatically. So, here, their ID r not playing a big role at all. Coz, i will have to fetch their title first and then arrange their order alphatically, which i understand cant be done with SQL alone.
I need a function ....is there any built-in one?
Now, i want this sublink title to be displayed alphatebatically. So, here, their ID r not playing a big role at all. Coz, i will have to fetch their title first and then arrange their order alphatically, which i understand cant be done with SQL alone.
I need a function ....is there any built-in one?
why can't you order by the sublink_title in sql? Just order by the sublink_title then.
or
if this isn't what you want try create a small diagram for what you want.
Code: Select all
.. ORDER BY `sublink_title` DESCCode: Select all
.. ORDER BY `sublink_title` asc