So there is my simple script to convert textdata/itemdata_xxxx.txt to MySql database.
Code:
<?php include('../config.php'); mysql_connect($cfg['MySqlHost'], $cfg['MySqlUsername'], $cfg['MySqlPassword']); mysql_select_db('item'); function explodeRows($data) { $rowsArr = explode("\n", $data); return $rowsArr; } function explodeTabs($singleLine) { $tabsArr = explode("\t", $singleLine); return $tabsArr; } $iconpath = "../icon/"; $filename = "itemdata_5000.txt"; $handle = fopen($filename, 'r'); $data = fread($handle, filesize($filename)); $rowsArr = explodeRows($data); for($i=0;$i<count($rowsArr);$i++) { $lineDetails = explodeTabs($rowsArr[$i]); echo "<br>item_id : " . $lineDetails[1]; echo "<br>item_name : " . $lineDetails[2]; $pattern = array('/\\\/'); $replacement = array('/'); $iconpath2 = preg_replace($pattern, $replacement, $lineDetails[54]); $array = explode('.', $iconpath2); $i1 = $array[0]; $item_icon_path_full = $i1.".PNG"; echo "<br>item_icon : " .$item_icon_path_full; echo "<br><br>"; $sql = "INSERT INTO itemdata_5000 (item_id, item_name, item_icon) VALUES ('".$lineDetails[1]."', '".$lineDetails[2]."', '".$item_icon_path_full."')"; mysql_query($sql)or die(mysql_error()); } ?>
Between every single character there is "WTF character" which blocks me every function i want to make with this data. I coulda use preg_replace() to remove this stuff, but idk what is that character and if i copy and paste this into it shows only "?" not the real character. Im really confused, and need help. I have never ever met shit like this stuff. Please help me
@edit
I would be satisfied if someone would send me some other itemsdatabase in txt or mysql or everything other. Converting this joymax stuff is hard as hell :/