suppose your data are store in a file with the following format
file1.txt
NULL;CA;Canada;
2;US;Units-States;
With php and mysql:
First make a simple connexion to your database..
Use the following function to to read a file and insert your data into database.
function importMyData($file_name) {
$t_file = file($file_name); // get data from the file
// for each line of the file do
for ($i=0; $i<count($t_file); $i++) {
$t_line = explode(";",$t_file[$i]);
$sql = "insert into (id, code, name)
values (".$t_line[0].",'". $t_line[1]."','". $t_line[2]."')";
mysql_query($sql,$cnx);
}
}