Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: I need simple storage & retreval of Information

  1. #1
    Join Date
    Aug 2007
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I need simple storage & retreval of Information

    I would like a script where i could easily store contact information (in an Array) on various business e.g.

    Name, Address,Phone Number, Fax Number, E-mail Address & Website Address. Then in the web page when you click

    on a link for Hotels then all the hotels will be displayed with their contact details or if you click on a

    link for Restaraunt all the restaraunt contact details will display. I have searched all over the net for

    this but i can't find a sample script that would do what i want. Is this possible to do with Javascript

    because it's not going to be a large database and i dont want to get into Php or Mysql database that would

    wreck my head .

    I would be very greatful if someboby could write a simple or a complex script to get me started as i do not

    know how to program in Javascript.


    I think i have posted this in the wrong section it should be in the i need a script section. Very sorry but i am new

    Many thanks...
    Last edited by trazix; 08-26-2007 at 02:38 PM. Reason: Placed it in the wrong section

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Probably not the best way to accomplish it, but this is just something that I came up with off the top of my head. Simply edit the contacts.js file (where it says "CONFIG") to list your contacts. If you would like a demo of what it does, go to http://phphost.smackum.com/dd/test/test.html.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Aug 2007
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default that was fast

    You are a super fast Genius thetestingsite. Thank you very much


    Is there a limit to the amount of information that can be stored in a .js file.

  4. #4
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Other than the maximum size of your disk space (on your server), there is no limit. Keep in mind; though, the more you put in the js file the longer it will take to load the info. When I get the time, I will post the PHP/MySQL equivalent to this so that when you are ready to upgrade, it will be a simple transition.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  5. #5
    Join Date
    Aug 2007
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Can you help me on this one

    The script that you provided works perfectly however when you begin filling in the data fields it becomes very clutered and it can become hard to edit in future if you need to.

    Would it be possible to store the data in a less cluttered way like this.

    Category[1] = "Hotels"
    Title[1] = "Name of Hotel 1"
    Address[1] = "Address"
    Phone[1] = "1234567890"
    Fax[1] = "0987654321"
    Email[1] = "name@Domain.com"
    Website[1] = "www.name.com"

    Category[2] = "Hotels"
    Title[2] = "Name of Hotel 2"
    Address[2] = "Address"
    Phone[2] = "1234567890"
    Fax[2] = "0987654321"
    Email[2] = "name@Domain.com"
    Website[2] = "www.name.com"

    Category[3] = "Hotels"
    Title[3] = "Name of Hotel 3"
    Address[3] = "Address"
    Phone[3] = "1234567890"
    Fax[3] = "0987654321"
    Email[3] = "name@Domain.com"
    Website[3] = "www.name.com"


    Category[4] = "Restaraunts"
    Title[4] = "Name of Restaraunt 1"
    Address[4] = "Address"
    Phone[4] = "1234567890"
    Fax[4] = "0987654321"
    Email[4] = "name@Domain.com"
    Website[4] = "www.name.com"

    Category[5] = "Restaraunts"
    Title[5] = "Name of Restaraunt 2"
    Address[5] = "Address"
    Phone[5] = "1234567890"
    Fax[5] = "0987654321"
    Email[5] = "name@Domain.com"
    Website[5] = "www.name.com"

    Category[6] = "Restaraunts"
    Title[6] = "Name of Restaraunt 3"
    Address[6] = "Address"
    Phone[6] = "1234567890"
    Fax[6] = "0987654321"
    Email[6] = "name@Domain.com"
    Website[6] = "www.name.com"


    Then when you click a link for hotels it displays only the hotel datails

    Also i would like the output to be displayed in a table where i can style the various elements with css.

    Would this be possible to do.

  6. #6
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    It would be, I would need to play around with it a little bit when I have the time, but it shouldn't be that hard. Also; as said before, you may want to use a database (MySQL/MS SQL) and server-side language (PHP/ASP) to store and retrieve this data. It would be easier to maintain and a lot less cluttered.

    For more info on how to do this, check out http://www.php-mysql-tutorial.com/.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  7. #7
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Ok; as promised, here is the modified version of contacts.js. I tested it and it works fine, but you can test it as well by going to the same link I posted in my second post.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  8. #8
    Join Date
    Aug 2007
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you for the script.

  9. #9
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    Quote Originally Posted by thetestingsite View Post
    It would be, I would need to play around with it a little bit when I have the time, but it shouldn't be that hard. Also; as said before, you may want to use a database (MySQL/MS SQL) and server-side language (PHP/ASP) to store and retrieve this data. It would be easier to maintain and a lot less cluttered.

    For more info on how to do this, check out http://www.php-mysql-tutorial.com/.

    Hope this helps.

    using a database also secures the integrity of the data better, since anyone can see the javascript file.

  10. #10
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Indeed; however, in this case I don't think that is an issue mostly due to the fact that the information in the javascript file is being displayed on the webpage anyway for anyone to see. This is a good point; though, just in case this project gets larger and you have more valuable info that needs to be stored.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

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
  •