I am building an associative array of information and then adding it to a history array by doing $histarray[] = $histrec;
I am then writing the $histarray
to mysql by doing serialize($histarray)
. I defined the field that I am writing to as a text field. The unserialize command quit working when the variable got quit large, > 64k and when I looked, the data is getting truncated. I rewrote my functionality to serialize and write the $histarray
to a folder and then read it and unserialize it. This does not cause the same problem and works well.
I have 2 questions.
- I assume that the mysql database or the php write to it is truncating the serialized data, but what specifically is causing this? I thought a field that was defined as text was basically unlimited in size.
- Is it faster to just read and write a file to a folder in this situation rather than store this info in a MYSQL table. It is only temp session data and does not need to be stored.