Menu

#8 Automatic Sort

open
nobody
None
5
2003-06-24
2003-06-24
Anonymous
No

Is there a way to automatically sort the data in
ascending or descending order the instant the data is
viewed? I mean, without having to click on the heading
names to sort the data.

What links may I need to change to make it work?

Thanks for your help!
Tom

Discussion

  • Nobody/Anonymous

    Logged In: NO

    This is ghetto, but it seems to work:

    diff entry.php entry.php.orig
    83,88d82
    < // BEGIN MY EDITS
    <
    < // get information
    < $item = get_items($categoryid);
    < $col = get_cols($categoryid);
    <
    91,92c85
    < list($by, $column) = each ($col);
    < $queryorderby = "colid".str_prepare($by);
    ---
    > $queryorderby = "itemid";
    106,107c99,102
    < // END MY EDITS
    <
    ---
    > // get information
    > $item = get_items($categoryid);
    > $col = get_cols($categoryid);
    >

     
  • Nobody/Anonymous

    Logged In: NO

    The last snippet does not work. Forgive me, but I'm just
    starting to learn php tonight while reviewing the author's
    code. This one seems to work though.

    diff entry.php entry.php.orig
    83,88d82
    < // BEGIN MY EDITS
    <
    < // get information
    < $item = get_items($categoryid);
    < $col = get_cols($categoryid);
    <
    91c85
    < $queryorderby = "colid".key($col);
    ---
    > $queryorderby = "itemid";
    105,106c99,102
    < // END MY EDITS
    <
    ---
    > // get information
    > $item = get_items($categoryid);
    > $col = get_cols($categoryid);
    >

     
  • Nobody/Anonymous

    Logged In: NO

    Bah, the last one does not work correctly.

    diff entry.php entry.php.orig
    83,88d82
    < // BEGIN MY EDITS
    <
    < // get information
    < $item = get_items($categoryid);
    < $col = get_cols($categoryid);
    <
    91c85
    < $queryorderby = "colid".key($col);
    ---
    > $queryorderby = "itemid";
    105,106c99,102
    < // END MY EDITS
    <
    ---
    > // get information
    > $item = get_items($categoryid);
    > $col = get_cols($categoryid);
    >

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.