SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Nov 2004
    Location
    Manchester, UK
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    re-order table using $variable

    I'm working on a script, where you search mysql and in the results you can click on the column headings and the table will re-sort the table according to that particular column.

    I'm having trouble getting this to work and was hoping for some advice?

    Here's the problem in more detail;

    I can pull up the whole table and re-sort it no problem - this works fine.

    When I use the search method I'm using to variables $searchterm and $searchtype. When I click on the columns it brings up an error message saying that these variables are empty.

    So, I think, the problem is being able to declare these variables again, but so far all the ways I thought off doing this haven't worked worked.

    Can any one help?

    t

    ta

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    As a basic fix, on the link to resort re echo the incoming vars...
    ie: if the incoming variable was type=black, re echo these on you column header type=black&sort=id
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    SitePoint Member
    Join Date
    Nov 2004
    Location
    Manchester, UK
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks

    I've done that using session_start().

    It works but the problem is if I now go back and type something different in the search box the variable i assign to whatever i type ($searchterm) is set to whatever i typed in first. The only way it will take a new search term is if I close the browser down and re-open.

    Have tried using session_unregister() and session_unset() to rectify but doesn't work. From what I understand If i'm using GET or POST (using post by the way) this automatically assigns a variable to $searchterm, so I've parse this info to my results.php page I just need to undo this for the original search page without affecting the results.php page.

    Sure there's some quite logical explanation but so far I cannot work it out?

    t

  4. #4
    SitePoint Member
    Join Date
    Nov 2004
    Location
    Manchester, UK
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, the best I can come up with after thinking bout it most of the day is a link from the results page to another page which has a re-direct back to the search page, after the redirection, I've cancelled the session variables.

    OK but personally would not want to do it this way. Makes it seem that it has a link back to the page but those who go back will find out that it doesn't. Anyone know of way to get round this problem


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
  •