Professional Web Applications Themes

Sorting tables - reference field - MySQL

I wonder if anyone can help... I have a database containing a number of tables. These tables can be sorted,displayed, and edited as desired by the user via php form. If the table is sorted by id, then if the user clicks the edit button for the third record down on his table then I know which record he wants to edit - id number 3. But if the table is sorted by something else it gets trickier - he clicked on row number three, but that may not be the recod with id=3 if it is sorted by something ...

  1. #1

    Default Sorting tables - reference field

    I wonder if anyone can help...

    I have a database containing a number of tables. These tables can be
    sorted,displayed, and edited as desired by the user via php form.

    If the table is sorted by id, then if the user clicks the edit button
    for the third record down on his table then I know which record he
    wants to edit - id number 3. But if the table is sorted by something
    else it gets trickier - he clicked on row number three, but that may
    not be the recod with id=3 if it is sorted by something else. Is
    there a way to have some sort of numeric reference field that is not
    affected by the sorting, so that it 1 will always refer to the top
    returned record, 2 the second etc...?

    I hope the above makes some sense...

    Cheers,

    Ben

    Ben Guest

  2. #2

    Default Re: Sorting tables - reference field

    Ben schrieb: 

    In the URL, use the DB table's row id instead of the display table's row
    number to identify the row being edited.

    HTH
    Jo
    Joachim Guest

  3. #3

    Default Re: Sorting tables - reference field

    On 7 Apr, 10:18, Joachim Durchholz <org> wrote: 
    >
    > In the URL, use the DB table's row id instead of the display table's row
    > number to identify the row being edited.
    >
    > HTH
    > Jo[/ref]

    Hi Jo - thanks for that. That would make more sense - at the moment I
    just use an incrementing counter. I'll see if I can change it -thanks.

    Ben

    Ben Guest

  4. #4

    Default Re: Sorting tables - reference field

    On 7 Apr, 10:20, "Ben" <com> wrote: 
    > [/ref]


    >
    > Hi Jo - thanks for that. That would make more sense - at the moment I
    > just use an incrementing counter. I'll see if I can change it -thanks.
    >
    > Ben[/ref]

    Yep -that worked. Thanks a lot!

    Ben Guest

  5. #5

    Default Re: Sorting tables - reference field

    On 7 Apr 2007 02:10:16 -0700, Ben wrote: 

    You put the id for the record into the link when you're generating the
    form.

    --
    16 megs in a '95 box! Yo Ho Ho and a battle of RAM!
    Peter Guest

Similar Threads

  1. CS - InDesign Tables - Sorting
    By Jamison_Deluski@adobeforums.com in forum Adobe Indesign Macintosh
    Replies: 2
    Last Post: September 21st, 09:53 PM
  2. Sorting address field
    By Kenny in forum FileMaker
    Replies: 2
    Last Post: February 18th, 03:11 AM
  3. Tables and Sorting
    By Darren in forum Macromedia Dynamic HTML
    Replies: 0
    Last Post: November 28th, 10:26 AM
  4. Sorting information from text-field
    By in forum PHP Development
    Replies: 3
    Last Post: October 29th, 11:03 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139