|
Posted by Gordon Burditt on 12/17/06 20:30
>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 multidimensional 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.
Navigation:
[Reply to this message]
|