Results 1 to 6 of 6

Thread: Did I setup mySQL table properly? + Password question.

  1. #1

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,819

    Did I setup mySQL table properly? + Password question.

    OK, this is really just an exercise for me to familiarize myself with how this all works and setting things up properly. So I'm making a guest book. I wasn't sure what the difference was between char, varchar, and the different text types. I kept getting errors when I was created fields using the text types, so I switched them to char. Maybe that's because I was trying to define the max length of the field? The documentation isn't all that great.

    Anyway, I've also read several things that say don't store the password in database. I want the users to be able to change their own entries, but only read other entries (with the exception of e-mail addresses). Basically the same as this forum works.

    Also, to contect to the database, I have to put my master password for my web hosting account. What's to stop someone from figuring out my password and having at it with my account? The password will need to be in the connection string to the database. What is it that I'm not understanding here?

    Here's how I set up the table sans password. Is this how it should be?
    Database guestbook - table Guests running on localhost
    table Guests has been altered.

    Field Type Attributes Null Default Extra Action
    GuestID bigint(20) No auto_increment Change Drop Primary Index Unique Fulltext
    FirstName varchar(15) No Change Drop Primary Index Unique Fulltext
    LastName varchar(15) No Change Drop Primary Index Unique Fulltext
    MiddleInitial char(1) No Change Drop Primary Index Unique Fulltext
    UserName varchar(15) No Change Drop Primary Index Unique Fulltext
    EMail varchar(125) No Change Drop Primary Index Unique Fulltext
    Date date No 0000-00-00 Change Drop Primary Index Unique Fulltext
    Comments longtext No Change Drop Primary Index Unique Fulltext
    With selected: Or


    Indexes : [Documentation]
    Keyname Type Cardinality Action Field
    PRIMARY PRIMARY 1 Drop Edit GuestID
    GuestID UNIQUE 1 Drop Edit GuestID
    Last edited by cafeenman; May 8th, 2002 at 01:54 AM.

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    get yourself this utility for handling mysql db's

    it makes like soooo much easier.

    varchar is like a variable length string; it's length will be from 1 to the length you specify depending on the length of the string it stores

    char is fixed length; it will always be the length you specify when defining the table regardless of contents. Usually it is best to stick with varchar

    The max of both is ~255...if you need to store stuff longer, then use Text which can be upto 2 billion characters or something crazy like that

  3. #3

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,819
    Can I upload that to where my site is hosted?

  4. #4
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    yes...just sling it in a dir and .htaccess the dir to stop others using it.

  5. #5
    scoutt
    Guest
    Also, to contect to the database, I have to put my master password for my web hosting account. What's to stop someone from figuring out my password and having at it with my account? The password will need to be in the connection string to the database. What is it that I'm not understanding here?
    because it doesn't work that way. unless you just gave it to someone, nobody will get it. the surfer can't see the php page itself but the rendered part of it. so they won't be able to see the connection to the database. do you see it on these forums? no that is because it is in the php script where you can't see it.

  6. #6

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,819
    OK, this is what I've got going so far. Chris, that app looks pretty much what my web host already provides.

    I realize this is really lame. I'm just happy that it works at all.

    http://www.paulkjohnson.com/modelbuilding/test2.php

Posting Permissions

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



Click Here to Expand Forum to Full Width