advantages of php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Goofy

    #1

    advantages of php

    hi all,

    i have to create a spelling and a picture game where words will be stored in
    database. for the spelling game, the word wil be splited in two parts.in the
    database the will be two columns the first syllabe and the ending syllabe
    column. i was wondering what type except of type varchar should be. should
    be primary or foreign key? i have decided to use php for that game as i am
    familar with. is this the best language for that system?

    Thanks



  • Erwin Moller

    #2
    Re: advantages of php

    Goofy wrote:
    [color=blue]
    > hi all,
    >
    > i have to create a spelling and a picture game where words will be stored
    > in database. for the spelling game, the word wil be splited in two
    > parts.in the database the will be two columns the first syllabe and the
    > ending syllabe column. i was wondering what type except of type varchar
    > should be. should be primary or foreign key? i have decided to use php for
    > that game as i am familar with. is this the best language for that system?
    >
    > Thanks[/color]

    Hi Goofy,

    Forgive me for being blunt, but your question gave me the impression you
    need to learn some (SQL)basics first.
    Try this for a SQL-primer (and learn about foreign keys, primary keys,
    datatypes, etc):
    W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

    You will find in the left frame both a SQL and a PHP primer.

    Be sure to to the SQL-lessons, they are really set up right and you will
    learn the basics in just 1 day.
    (I do not know if you need the PHP primer, up to you.)

    Foreign keys are used to ensure database integrity and are used when you
    reference a value from another table (often the Primary Key).
    (In my humble opinion they should ALWAYS be used in that situation.)

    As for the datatype (varchar), that depends on the database you will use.
    Not all databases have the same datatypes.
    In general: varchar is a good choice because the length is variable.
    Only drawback is that it uses 16 bytes (in most cases I saw) to just store
    nothing. 17 for 1 char, 18 for 2 chars, etc.
    The reason is varchar uses 2 pointers to point to the beginning and the end
    of the string, and (in most cases i saw) a pointer takes up 4 bytes.
    So varchar can be a bit 'heavy' in certain cases, but do not worry about
    that for now, just use it. :-)

    Good luck Goofy, and drop back in here if you have questions.

    Do you know which database you will use?

    Regards,
    Erwin Moller

    Comment

    • Erwin Moller

      #3
      Re: advantages of php

      Erwin Moller wrote:
      [color=blue]
      > In general: varchar is a good choice because the length is variable.
      > Only drawback is that it uses 16 bytes (in most cases I saw) to just store
      > nothing. 17 for 1 char, 18 for 2 chars, etc.
      > The reason is varchar uses 2 pointers to point to the beginning and the
      > end of the string, and (in most cases i saw) a pointer takes up 4 bytes.[/color]

      As you can see I should go to w3schools too and do a basic
      calculationscou rse.
      4bytes + 4bytes = 16 bytes?
      Hmmm....



      Comment

      • Goofy

        #4
        Re: advantages of php


        ? "Erwin Moller"
        <since_humans_r ead_this_I_am_s pammed_too_much @spamyourself.c om> ?????? ???
        ?????? news:412efaf0$0 $36860$e4fe514c @news.xs4all.nl ...[color=blue]
        > Goofy wrote:
        >[color=green]
        > > hi all,
        > >
        > > i have to create a spelling and a picture game where words will be[/color][/color]
        stored[color=blue][color=green]
        > > in database. for the spelling game, the word wil be splited in two
        > > parts.in the database the will be two columns the first syllabe and the
        > > ending syllabe column. i was wondering what type except of type varchar
        > > should be. should be primary or foreign key? i have decided to use php[/color][/color]
        for[color=blue][color=green]
        > > that game as i am familar with. is this the best language for that[/color][/color]
        system?[color=blue][color=green]
        > >
        > > Thanks[/color]
        >
        > Hi Goofy,
        >
        > Forgive me for being blunt, but your question gave me the impression you
        > need to learn some (SQL)basics first.
        > Try this for a SQL-primer (and learn about foreign keys, primary keys,
        > datatypes, etc):
        > http://www.w3schools.com
        > You will find in the left frame both a SQL and a PHP primer.
        >
        > Be sure to to the SQL-lessons, they are really set up right and you will
        > learn the basics in just 1 day.
        > (I do not know if you need the PHP primer, up to you.)
        >
        > Foreign keys are used to ensure database integrity and are used when you
        > reference a value from another table (often the Primary Key).
        > (In my humble opinion they should ALWAYS be used in that situation.)
        >
        > As for the datatype (varchar), that depends on the database you will use.
        > Not all databases have the same datatypes.
        > In general: varchar is a good choice because the length is variable.
        > Only drawback is that it uses 16 bytes (in most cases I saw) to just store
        > nothing. 17 for 1 char, 18 for 2 chars, etc.
        > The reason is varchar uses 2 pointers to point to the beginning and the[/color]
        end[color=blue]
        > of the string, and (in most cases i saw) a pointer takes up 4 bytes.
        > So varchar can be a bit 'heavy' in certain cases, but do not worry about
        > that for now, just use it. :-)
        >
        > Good luck Goofy, and drop back in here if you have questions.
        >
        > Do you know which database you will use?
        >
        > Regards,
        > Erwin Moller
        >[/color]
        i will use mysql database


        Comment

        Working...