Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Junior Member eevanich's Avatar
    Join Date
    Sep 2008
    Location
    Eugene Or
    Posts
    2
    Member #
    17372
    I recently started paying for web hosting service through Hostgator, and they use MySQL databases. I bought a book on SQL (for beginners) and began to read it, however I now feel that the book I may have bought doesn't include the information I need to make the website that I want to make. The main question that I need to be answered at this time is what type of database tables I need to set up in order to have users on my site register new user names and be able to log into them (much like a forum or like You tube).

    The grand idea for the site is to have people be able to post a wide variety of images on the many boards and have other comment and rate those images. Things ranging from fashion, to typical body pictures (all appropriate) to artwork and writing.

    I have a basic understanding for how MySQL databases work and they seem pretty straight forward, now what I need to know how to do it to adapt that to a website. From what I can guess I think I need a field that is unique for usernames and when they log in I need to set up the site so that it retrieves the data from other tables pertaining to that specific user.

    If someone can help me get started with this I would be more than happy to get to work and post additional questions at a later time.

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Yes, you need a primary key(s) in one table that acts as a foreign key in another table. For example, you mention users being able to post images. For that you would need two tables.

    One table (users) would store the users details. Some suitable fields are the users real name, users age, users location, username, email address, etc.......)

    In the users table you would need a unique field which will be your foreign key later on.

    Now, in your images table you will need fields such as image name, image path, width, height, description etc...

    But you also need a field that stores the unique field from our users table, this way you can easily find out who posted what.

    Furthermore, a similar step would be needed for dealing with comments being made on images.

  4. #3
    Junior Member eevanich's Avatar
    Join Date
    Sep 2008
    Location
    Eugene Or
    Posts
    2
    Member #
    17372
    Thanks, I set up the primary key and the foreign key for two tables (userdata and image tables) and now I'm setting up the image name, image path, width, height and description fields. For the image name and image path I think I should use varchar types and I was wondering about how many characters I should allocate for each of those categories. For width and height i was thinking int types with about 5 characters (int(5)).

    For description, im guessing that should be varchar also but how many characters would you allow? Since it was a brief description, maybe 3-4 sentences I was thinking maybe 350... Does that sound about right?

  5. #4
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    For image dimensions I would say most would be xxx by yyy so yes, int(5) is a good starting point.

    For the description, well this will depend on the image itself. There is a saying. "A picture is worth a thousand words" so maybe consider a larger field type such as TEXT.

    It is your choice though, as this is your first dip into this area of development, you will have to find your way and you will discover and build up your own way of doing things.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 02:15 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com