|more useful options|
Re^6: Error in insertion of MULTIPLE FILENAMES & CONTENTS INTO DATABASEby Nik
|on Jan 02, 2008 at 16:37 UTC||Need Help??|
After some testing i noticed that while(<FILE>) returns a line-by-line data of the file and it is storing it in $_
That's good by what i need is to get to whole data content in one var so the above solution aint gonna help me, of course i could concatenate every line after another to construct the whole data of the file but that would be dumb.
I noticed after trying every weird idea that came into my mind that $data=<FILE> would save the whole file's contents in a split of a sec without the need for looping, so what i did to make the job done was the following:
All that in order to achieve opening of all files one-by-one and inserting each of the filename and its corresponding content as an entry in mysql table 'articles'
After running this test script:
i noticed 2 errors i cannot solve:
a) The '$_' doesn't hold the value of the current filename opened without paths and extension but instead it has the number of '1' in it. Its a syntax error obviously that i have made and don't know how to properly write it.
b) @data though it is correct because it contains the contents of each file when looping and contents are stored by me in utf8 when i write the text files