![]() |
[SHARE] Import itemname-e.txt into mySQL from PHP
Topic says all
[php:1:da72899f17] <?php $dblink = mysql_connect(, , ); ($dblink) ? $dbselect = @mysql_select_db("") : DIE("Link to mySQL server could not be established."); if (!$dbselect) DIE(mysql_error()); $row = 1; $handle = fopen("itemname-e.txt", "r"); while (($data = fgetcsv($handle, 1000, "\t")) !== FALSE) { $row++; $query = " INSERT INTO `itemname-e` SET `id`=".$data[0].", `name`='".addslashes($data[1])."', `additionalname`='".addslashes($data[2])."', `popup`='".$data[3]."', `description`='".addslashes($data[4])."' "; $result = mysql_query($query); if ($result) { print $data[1]."\r\n"; } else { print mysql_error(); sleep(30); } } fclose($handle); ?> [/php:1:da72899f17] The SQL Schema Code:
CREATE TABLE `itemname-e` ( |
oh, and I should comment that this script assumes you have removed all the field information like "id=" and "name=[]" etc
If you want to store that info in the mysql table, the script can easily import it but you will need to change the data types in the mysql table so it can be stored properly. |
Isn't it much easy using the php from the php decryptor?
its not so easy to erase all the field information ... |
Sure, if thats all you plan on doing. Personally, I have the entire client dats in mySQL. I am then able to create programs that perform a wide variety of tasks automatically for me. I also do the same thing with ALL of the server files as well. This allows me to easily sync changes when new versions of l2 come out and etc.
|
| All times are GMT. The time now is 23:35. |