Uploading text files

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

    #1

    Uploading text files

    Greetings.

    I'm somewhat new to this whole MySQL/PHP thing and need a little help.

    My web hosting service uses phpMyAdmin and at the bottom of the screen
    iis an area where I can upload a text file to populate a table.

    I have a table named groups with two fields:
    groups_id auto-increment primary
    groups_name

    So how do I create my text file to populate this table?

    I'm going to use MS Notepad.

    If it's set to auto-increment, do I need to include the number? If
    so, does it start at 0 (zero)?

    Would the file look like:

    0,students
    1,faculty
    2, staff

    or just

    students
    faculty
    staff

    (though I can't image that working).

    Any help is appreciated.

    Thanks.

    Ward
  • Kristofer

    #2
    Re: Uploading text files

    Ward B wrote:

    [ snip ]
    [color=blue]
    > If it's set to auto-increment, do I need to include the number? If
    > so, does it start at 0 (zero)?
    >
    > Would the file look like:
    >
    > 0,students
    > 1,faculty
    > 2, staff
    >
    > or just
    >
    > students
    > faculty
    > staff
    >
    > (though I can't image that working).
    >
    > Any help is appreciated.[/color]

    Assuming you are using the link "Insert data from a text file into the
    table" from the SQL window, you can either do it either way.

    By default it will expect both columns (in your first example).

    Alternatively, you can put "groups_nam e" into the "Column names" field,
    and feed it your second example. That way it will only expect you to
    provide the groups_name column, and it will auto-increment the first
    column for you.

    Kristofer

    Comment

    Working...