Adding rows to a database

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

    #1

    Adding rows to a database

    Hi.

    Trying to create a program which splits up a large amount of text into
    small pieces, puts these pieces into a database, allowing for later
    reuse.

    The problem is since each text file is a different size in length i
    can't reprogram the right amount of tables without manual work.

    I've tried importing the files through the database in a array, it
    converts it into a string containing "array"

    So, either

    1:can you add database rows onto a table after creation?

    2: Is there any way to descramble the array package to grab each
    individual variable?

    I'm still a beginner to PHP and MySQL so apologise if this is something
    basic.

    BTW: I use php 4.

  • Gordon Burditt

    #2
    Re: Adding rows to a database

    >Trying to create a program which splits up a large amount of text into
    >small pieces, puts these pieces into a database, allowing for later
    >reuse.
    >
    >The problem is since each text file is a different size in length i
    >can't reprogram the right amount of tables without manual work.
    A database field such as MySQL's 'text' type (or 'long text') allows
    a lot of flexibility in stuffing whole files into a database field.
    Even 'varchar' is good for relatively short strings that vary in length.
    >I've tried importing the files through the database in a array, it
    >converts it into a string containing "array"
    Databases in general do not have an 'array' type for a field. An
    array is typically represented in a table having columns for "which
    array", "array subscript (for multidimensiona l arrays you may have
    more than one column here)", and "value", and having one row for
    each array element.
    >1:can you add database rows onto a table after creation?
    Rows, yes, databases would be useless if you can't put data in them.
    Columns, yes, if you have privileges to alter the schema, but having
    a dynamic schema is generally a very, very bad idea.
    >2: Is there any way to descramble the array package to grab each
    >individual variable?
    What's an "array package"? Are you referring to serialize() and
    unserialize()? You can serialize() an array, store it in a database,
    and fetch it later and unserialize() it to use it. However, you
    can't generally have the database meaningfully look at what's inside
    the serialize()d array.
    >I'm still a beginner to PHP and MySQL so apologise if this is something
    >basic.

    Comment

    • Jeff North

      #3
      Re: Adding rows to a database

      On 17 Dec 2006 11:04:35 -0800, in comp.lang.php "conspiracy cam"
      <moonhoax@gmail .com>
      <1166382275.739 961.278630@l12g 2000cwl.googleg roups.comwrote:
      >| Hi.
      >|
      >| Trying to create a program which splits up a large amount of text into
      >| small pieces, puts these pieces into a database, allowing for later
      >| reuse.
      >|
      >| The problem is since each text file is a different size in length i
      >| can't reprogram the right amount of tables without manual work.
      >|
      >| I've tried importing the files through the database in a array, it
      >| converts it into a string containing "array"
      >|
      >| So, either
      >|
      >| 1:can you add database rows onto a table after creation?
      >|
      >| 2: Is there any way to descramble the array package to grab each
      >| individual variable?
      >|
      >| I'm still a beginner to PHP and MySQL so apologise if this is something
      >| basic.
      >|
      >| BTW: I use php 4.
      Post about ten lines of the sample data. Remove any sensitive data
      before hitting the send button.
      ---------------------------------------------------------------
      jnorthau@yourpa ntsyahoo.com.au : Remove your pants to reply
      ---------------------------------------------------------------

      Comment

      Working...