Txt file loading into DB<

liunx

Guest
hi, i ahve a problem

if you view the attachement you will see a file with items in it for my online game. as you can see i formatted vertying with tabs and spaces. now i want to laod this text file into my mysql db.

the problem is i can't explode() to cooperate with me and turn every line into a array.

i guess i need to trim tabs and spaces so there is only one space betweem every item option but that is what i can't find out how to do :D

don't note the tyupos i ype afast :D:D

please note that the the layout ****ed up when i nuploaded it.
i also have the txt file rarred: <!-- m --><a class="postlink" href="http://www.gq-guild.com/items_db.rar">http://www.gq-guild.com/items_db.rar</a><!-- m -->
I don't know if you can do anything about the layout that ****ed up, but i guess you get the point :)


thanks in advabcehmmmm, that could be a tough one. it would have been better to have it comma seperated instead.

you could try the load infile (<!-- m --><a class="postlink" href="http://dev.mysql.com/doc/mysql/en/LOAD_DATA.html">http://dev.mysql.com/doc/mysql/en/LOAD_DATA.html</a><!-- m -->) query for mysql. but you must have file privilege set.

I suppose you can get real detaile dand write a regular expression to parse it out.ok thanks for the adviece ill look into that stuff, an d if all fails ill just ue commas :D
 
Back
Top