Random Phrase Generator

Discussion in 'Programming' started by philb, Mar 25, 2012.

  1. #1
    philb, Mar 25, 2012 IP
  2. Grit.

    Grit. Well-Known Member

    Messages:
    1,424
    Likes Received:
    22
    Best Answers:
    1
    Trophy Points:
    110
    #2
    Firstly, if you're looking to mimic that site, work out in your head how it works.

    Get out some trusty paper and a pen, and plan out the project. Decide how the data is stored, and how you want the user to interact with it.
    If you start by drawing out the form, and then deciding the elements.

    To me, I would think of it this way:
    1: Create the form
    2: Create the database setup (only one table needed)
    3: Create the database fields etc I would probably use id (primary key), word, type (int or something smaller, to decide type e.g 0 = noun, 1 = verb) and rarity (similar to type)
    4: Add all your words to your database
    5: Create the Database connection
    6: Create the script to pull the data.
    Check the field type select, and then select a random word from the database where the type is equal to type (e.g. noun) and rarity is equal to rarity selected
    Keep checking fields until no more are selected or word limit reached
    Echo out the data

    Everyone approaches these projects differently, but I hope this helps
     
    Grit., Mar 25, 2012 IP