Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8424699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:04:25+00:00 2026-06-10T04:04:25+00:00

Here is what my table looks like: http://jsfiddle.net/Draven/kGtx7/14/ Each header cell is clickable to

  • 0

Here is what my table looks like: http://jsfiddle.net/Draven/kGtx7/14/

Each header cell is clickable to be able to sort by that field and by ASC / DESC.
I want to be able to store that sorting option somewhere, so it get’s remembered, but am not sure the best way to do that.

Here are the options I was thinking…

  1. Making sort_field and sort_order fields in the users table
  2. Making a new table that has their userid along with sort_field, and sort_order fields
  3. Or Cookies, but I assume this is the worst option
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T04:04:26+00:00Added an answer on June 10, 2026 at 4:04 am

    I don’t think we are clear on what you want, but I think you are wanting something like this:

    Step 1: Run a query than will populate the sorting values into 2 session variables.
    Step 2: Do something like this code.

    $sortHeadClicked = $_SESSION['headClicked']
    $sortReturnDirection = $_SESSION['returnDirection']
    
    //TODO: validate data before query
    
    if ($result = $mysqli->query("SELECT * FROM table ORDER BY $sortHeadClicked $sortReturnDirection)) 
    {
        //TODO: Get results
    }
    

    Step 3: Smile like your awesome

    Alternatively, you could use some sort of sub select query.

    NOTE: This is the simplistic logic so they won’t be remember with this example. However, you can put the gets into session variables if you only want them to be remember temporarily

    However, if you want these remembered permanently, you need two columns in your user’s table where you would either puts them into sessions or use a subselect query

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my current fiddle: http://jsfiddle.net/UjAQf/28/ I want to design the table in such a
I have table like this -> http://jsfiddle.net/jurisKaste/FvgeQ/ And I need to get array of
JSfiddle: http://jsfiddle.net/ybZvv/57/ I have a fiddle here where the user can append row and
the html looks like below or you can find it here http://www.vbulletin.org/forum/index.php <!-- login
I've made a demo of what I'm trying to do here in jsFiddle: http://jsfiddle.net/clowerweb/SbNdb/
http://logging.apache.org/log4net/release/config-examples.html Given the log table here: CREATE TABLE [dbo].[Log] ( [Id] [int] IDENTITY (1,
I have a MySQL Table that looks like this: The SQL to create the
I have a table that looks like this: I have this same chart on
I have created as css to have borders so that the table looks like
I'm trying to create a page which looks somewhat like this: http://www.drmichaelbogdan.com/plastic-surgery/ (I'm referring

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.