Help with a simple database lookup

Posted on 2006-06-01
Last Modified: 2010-04-09
Hi - I have a fairly simple database of two sets of numbers - group and ID.  I need to make a webpage that the user would enter the group number and it would show the applicable IDs associated with the group.  The database is currently in Excel, but it can be exported to anything.  I don't know SQL so I am not sure if this is possible in just HTML.  Thanks for the help.   == Rob ==
Question by:Robincog
    LVL 17

    Expert Comment

    What is the back end technology?
    AJAX can be a solution for you. But all depends on your approach

    Author Comment

    Like using an get command in XML?

    Anyway - linux box server, Java2SDK only no servlets, standard stuff as well perl, C, PHP4 - all could be solutions if needed, but I was also wondering if there was a much more simple, though less elegant HTML solution?

                    == Rob ==
    LVL 30

    Expert Comment

    If there is not too much data, you can use a flat text file to store your data.
    Then use php to read the file and only return the data that has been asked.
    XML will be much heavyer.

    Author Comment

    There is a minimum of 3,000 records (1,500 of each), and a max of 22,000 (11,000 of each) but the first column is only six digits and the second is eight.  I could sub-divide the records into major groups 1-2, 3-4, 5-6, etc if that makes it into a managable size for the lookup.
    LVL 30

    Accepted Solution

    You should definitely not load the entire file into memory.
    Just read some bytes at a time.
    This is is an example that echoes a file:

      function echoFile($filename) {

        $myhandle = fopen($filename, 'r');
        while($mybuffer = fread($myhandle, 512)) {
          echo $mybuffer;


    512 is the number of bytes read, so if your records are fixed byte-size, that's easy to do:
    Just add a test in the while loop, adjust the size of the buffer and you are done!
    ...but a slight corruption in the file and it won't work anymore.
    You'll need to do some benchmarking, but i think it's a workable solution.
    LVL 10

    Assisted Solution

    There is a simple but less elegant solution in just html.  Create a select box with all of the records as name/value pairs.  Then the user can just select the record number from a list.  Or, if a type in and lookup solution is preferred, a simple javascript call could do this.  However, be warned that this could be quite a slow page load.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
    Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
    In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
    HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now