Jump to content

displaying entries in order


pouncer

Recommended Posts

I have a table called forum_name with these fields

 

forum_id (primary key)

user_id (user id of admin who made the new discussion forum)

forum_name

forum_description

 

Basically, I've just made a simple form for the admin to fill in a new forum name and descriptino and it inserts it into the database on those fields.

 

However, what i need help on, is the ordering. I want to be able to change the order in which i display the discussion forums.

 

e.g, if i made a forum for 'cars' then another forum for 'interests'

 

this will display on the forums page

cars

interests

 

how could i swap the order so it displays

interests

cars

 

could someone show me a solution as to how i can do it please?

Link to comment
https://forums.phpfreaks.com/topic/39015-displaying-entries-in-order/
Share on other sites

as my understanding, the forum names are grabbed from database. 

in your query, put order by forum_name desc to make it arrange the forum name in reverse order.

 

like this:

 

$sql = "select * from table order by forum_name desc limit 5";

 

just an example of how to use order by

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.