Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Dec 2010
    Location
    London
    Posts
    339
    Thanks
    63
    Thanked 11 Times in 11 Posts

    remembering a user search query.

    Hello.

    I have a listings website where users can search with various criteria, such as below;

    area: 'London'
    date: '2nd November'
    price: 'less than £5'

    this is then put into the URL query string... mywebsite.com/search.php?area=london&date=02112012 etc...

    I want the users to be able to save their search for future use, accessable from a hyperlink in their home area.

    I see two solutions...

    1. creating a table in my database with the rows, 'memberid', 'area' , 'date', 'price' and store them this way. With any search fields being left blank inserting a NULL value. I would then build the URL with php echo's from the database like mywebsite.com/search.php?area=<?php echo $row['area']?> etc...

    2. Saving the entire URL into the database with use of $_SERVER features, linked to the members ID.

    I'm pretty sure the 1st option is the way to go, but is there any other method that would be better for this before I begin working on it?

    Any advice would be appreciated.

    Cheers
    Pat.

  • #2
    Regular Coder Redcoder's Avatar
    Join Date
    May 2012
    Location
    /dev/null
    Posts
    334
    Thanks
    2
    Thanked 48 Times in 47 Posts
    I would go with Option number 2 personally...it involves less work during storage and retrieval and therefore faster though it's a negligible increase in speed. You only have to fetch one row per search unlike Option 1. Unless of course you have database space in Kilobytes and you want to save as much space as possible because saving all search queries in a Listings website could escalate quickly

  • #3
    Regular Coder
    Join Date
    Dec 2010
    Location
    London
    Posts
    339
    Thanks
    63
    Thanked 11 Times in 11 Posts
    Thanks for you help. I've had more of a think about it and the features i can offered the user, and realised the first option would actually provide me with a handy tool for showing 'suggested searches'. I could find the fields the user commonly has saved, such as 'price: under £5', and 'London', and suggest them events based on their previous searches... would be quite handy. I don't think that's as easy with the second option.

    cheers though, much appreciated.

    btw, i checked out the link on your signature and i'm not sure if you're aware but theirs a conflict in the amount of pages you offer for pacakges in the footer of your site compared to the actually 'web design' page. (just a heads up )

  • #4
    Regular Coder Redcoder's Avatar
    Join Date
    May 2012
    Location
    /dev/null
    Posts
    334
    Thanks
    2
    Thanked 48 Times in 47 Posts
    The suggested searches would definitely not be possible with Option 2. Not impossible but not very possible hehe.

    Thanks for the heads-up about the signature. I will change it when I get back home Appreciated.


  •  

    Posting Permissions

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