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 6 of 6
  1. #1
    New Coder
    Join Date
    May 2010
    Location
    Saint Louis, MO
    Posts
    31
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Question Is there more to searching a website than just the Javascript?

    Hi all - I'm designing a website, and I need to have a search button allow users to search the inventory that is on the website. I'm not quite sure what code I'm going to use for the search button, but I imagine that I can work on that sometime.. Along with the code, am I required to have something such as a MySQL database set-up or something of the sort?

    This question may be mis-categorized, so please let me know if it is.

    Thanks everyone!

  • #2
    New Coder
    Join Date
    Jun 2010
    Posts
    16
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Any easy options is to use Google's custom search on your page. Easy to implement - and will give you the functionality you're looking for.


    Google's CSE

  • #3
    Regular Coder jfreak53's Avatar
    Join Date
    May 2004
    Location
    Guatemala
    Posts
    477
    Thanks
    19
    Thanked 10 Times in 10 Posts
    True, if you aren't using a CMS system or something else like a blog or ecommerce solution that already includes it, Google would be easy to get working.

    But if you want to make your own solution, then it would all depend on what your searching, let's start there.

    What is it that your searching through? You can't come to the tech until you know what your data is and where it's stored.

    So second question, what data is it? Where is it stored at, MySQL DB, XML, or plain text file?

    Without this you cannot go from there.

    I'm not a JS guy but I'm pretty sure I wouldn't use IT directly to do the search. If for instance it was all stored in a mysql DB I would use SQL to search the DB then just send back to the page the results, very simple. That's what most search things do since most items that are search for are stored in a DB.

    Now if it's stored in an XML file then yes I might use JS since I'm not good at XML in PHP or anything else. I think it would just be a matter of reading the things to be searched into an array then searching that array with a regex function. I think, but I'm not an XML guy.

    But first things first, answer those previous questions and we find the best solution for you. Unless you went with Google.
    "FORTRAN is not a language. It's a way of turning a multi-million dollar mainframe, into a $50 programmable scientific calculator."
    http://www.microfastcat.com -- FastCat Software, the fastest software on the NET!
    http://www.microthosting.com -- Free reseller web hosting, Hosting, VPS, FREE SMALL HOSTING!!!
    http://www.microtronix-tech.com -- Web design and programming

  • #4
    New Coder
    Join Date
    May 2010
    Location
    Saint Louis, MO
    Posts
    31
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by jfreak53 View Post
    True, if you aren't using a CMS system or something else like a blog or ecommerce solution that already includes it, Google would be easy to get working.

    But if you want to make your own solution, then it would all depend on what your searching, let's start there.

    What is it that your searching through? You can't come to the tech until you know what your data is and where it's stored.

    So second question, what data is it? Where is it stored at, MySQL DB, XML, or plain text file?

    Without this you cannot go from there.

    I'm not a JS guy but I'm pretty sure I wouldn't use IT directly to do the search. If for instance it was all stored in a mysql DB I would use SQL to search the DB then just send back to the page the results, very simple. That's what most search things do since most items that are search for are stored in a DB.

    Now if it's stored in an XML file then yes I might use JS since I'm not good at XML in PHP or anything else. I think it would just be a matter of reading the things to be searched into an array then searching that array with a regex function. I think, but I'm not an XML guy.

    But first things first, answer those previous questions and we find the best solution for you. Unless you went with Google.
    Well, all of the data would just be in a plain text file, basically. I want a user to be able to search through the list of inventory that we have - books, mainly. However, I want them to be able to search by 3 variables: price, genre/category, and keyword.

    I'm not sure if I should set up some kind of database! I imagine that would be helpful in organizing the inventory, but would it be needed for the user to be able to search?

  • #5
    New Coder
    Join Date
    May 2010
    Location
    Saint Louis, MO
    Posts
    31
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Oh - and I did try Google, but that's definitely not for me.. It was a great suggestion though!

  • #6
    Regular Coder jfreak53's Avatar
    Join Date
    May 2004
    Location
    Guatemala
    Posts
    477
    Thanks
    19
    Thanked 10 Times in 10 Posts
    Wow flat text file WOW! ha ha

    I suggest yes, 100% use a DB! There is no easy way to do that in a plain flat text file, only other thing you could use would be XML.

    For a text file be it in JS or PHP that you search with you would have to itterate through all the text file and read each line into an array, then search that array. You would have to do that for searching and for displaying, ewwwww.

    Why would you do it that way when you can use a DB like MySQL or PGSQL?

    Then all your data is organized in a table with columns and it is sorted. Use MySQL man, and grab it all with PHP or another server side language. Then you can search it very simple like. A quick search in MySQL would be like this:

    Code:
    SELECT * FROM table_name WHERE column LIKE '%search_text%'
    That simple little line of code says this. Select all items from the table named "table_name" where the column named "column" has text in it that matches "search_text". It will only send you the items in the table that have that text somewhere in that column. Very quick and simple.

    So in short, learn a SSI language and learn SQL, then save your info in a MySQL DB. Or easier, hire someone to do this for you. It's pretty easy shouldn't be too expensive. Heck let me know I could do it for you if you want to hire it out.
    "FORTRAN is not a language. It's a way of turning a multi-million dollar mainframe, into a $50 programmable scientific calculator."
    http://www.microfastcat.com -- FastCat Software, the fastest software on the NET!
    http://www.microthosting.com -- Free reseller web hosting, Hosting, VPS, FREE SMALL HOSTING!!!
    http://www.microtronix-tech.com -- Web design and programming


  •  

    Tags for this Thread

    Posting Permissions

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