Web Hosting Info

Search:

featured partner

The IP to Country Database

  Forum Topics : Support / How to use the CSV Database and how to convert it to mysql
Submitted by Umiyz on Tue, 08/09/2005 - 14:40.
Hello everyone,

First off all i have used the SEARCH Function but it didnt help me much because ive not much experience with mysql.
Ive also checked your FAQ (handbook).
Also no success so i thought ill post my problem in here.

I have not much experience with this database nor with mysql(i mean with the table).
I have been building some webbies and with many thanks to other ppl for there help.
I was wondering how i could convert the CSV Database into a .sql file because im having problems with sorting this out.
I was actually looking for Webstats which i found one and it looks great but cannot use it because it needs the installation of IP 2 Country.
So i was hoping if anyone could help me.
I self own a website with php/mysql so these easy things should not be a problem.
Comment viewing options:
Select your preferred way to display the comments and click 'Save settings' to submit your changes.
You have first to create the
Posted by D_A on Wed, 08/10/2005 - 13:30.
You have first to create the table (phpmyadmin would help you), use the info of http://ip-to-country.webhosting.info/node/view/54 or use
CREATE TABLE `nameofthetable` (
  `IP_FROM` double NOT NULL default '0',
  `IP_TO` double NOT NULL default '0',
  `COUNTRY_CODE` char(2) character set latin1 collate latin1_general_ci NOT NULL default '',
  `COUNTRY_CODE2` char(3) character set latin1 collate latin1_general_ci NOT NULL default '',
  `COUNTRY_NAME` varchar(64) character set latin1 collate latin1_general_ci NOT NULL default '',
  PRIMARY KEY  (`IP_FROM`,`IP_TO`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Then unzip the the latest IP-to-Country Database and (with phpmyadmin too) "Insert data from a text file into the table". use Fields terminated by , and Lines terminated by \r
 
Sorry no success :( I have m
Posted by Umiyz on Wed, 08/10/2005 - 15:04.
Sorry no success :(
I have made the table as webstats but i dont get the Insert data from a text file into the table thing.

I have unzipped the database i downloaded and its now a CSV file but how do i insert the data into mysql ?
 
Do you use phpmyadmin ? It is
Posted by D_A on Wed, 08/10/2005 - 15:47.
Do you use phpmyadmin ? It is the easiest way.
If you don't, the php code to insert the data if it is located in c: is
LOAD DATA LOCAL INFILE 'c::\\ip-to-country.csv' INTO TABLE `webstats` FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\r'
 
Yes i do use phpmyadmin to co
Posted by Umiyz on Wed, 08/10/2005 - 16:58.
Yes i do use phpmyadmin to control mysql.

Cant you give me a sql file or something because this is pretty hard for me lol :(.

I have done the table part but how do i put the lines into the database ?
 
You will find some screenshot
Posted by D_A on Thu, 08/11/2005 - 04:46.
You will find some screenshots with PHPMyAdmin to help you at http://d1.a.free.fr/
 
Problem installing the db running the script
Posted by method on Fri, 04/07/2006 - 01:20.
could any one help me install this on my apache webserver i keep getting 300 seconds exceded!! aloso when i run the following script :
http://ip-to-country.webhosting.info/node/view/118
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\wamp\www\ip-to-country\detectcountry.php on line 25


pointing to this line :

// Fetching the record set into an array
$ccode_array=mysql_fetch_array($country_exec);

could any one tell me what is wrong here.Thanks
 
How to bypass
Posted by keitai on Fri, 04/07/2006 - 14:48.
how to bypass the max of 2048kb for a file I may upload??

Which program should I use to cut the .csv in smaller files??

Kind regards
 
You can modify upload_max_fil
Posted by D_A on Sun, 04/09/2006 - 09:20.
You can modify upload_max_filesize in php.ini
You can use open office calc or a text editor (CONTEXT for example) to cut the csv file
 
Tx to D__A this worked
Posted by keitai on Tue, 04/11/2006 - 07:01.
@ D__A, thnks for your help.

I have made chunks in open office
1000.csv
1000-10000.csv
10000-20000.csv
20000-more.csv (this one was exact 2.048kb)
uploaded the 4 files

For others, you might want to do
0-20000.csv
20000-more.csv

Tx
 
You do not need to upload the file itself
Posted by McAfee on Fri, 04/14/2006 - 11:28.
13.2.5. LOAD DATA INFILE Syntax
http://dev.mysql.com/doc/refman/4.1/en/load-data.html

Please check the LOCAL option. It will parse the file on the client side, and just send raw data thru the connection. I suggest using compression for the MySQL connection.

This way you can avoid any file size constraints on the server. But you have to be able to directly connect to the MySQL server. I don't know if it would work in phpMyAdmin.

Here's another option: Sometimes the constraints are for HTTP uploads, can't you FTP the file into your server?
Hi every body i have the same
Posted by faimo on Sat, 09/09/2006 - 17:18.
Hi every body i have the same problem as Umiyz . i followed all the mentioned steps but always i get the message : You should select file which you want to insert.
although the file is already selected .
is there any suggestion .

many thanks