Basic solution
// Abrir documento fonte
$name_src = "nome_documento.txt";
$h_src = fopen($name_src,"r");
// Leitura linha depois linha até o final
while (($str_src = fgets($h_src)) !== false)
{
// Explode sobre TAB
$tab = explode("\t",$str_src);
// Prepara o query (exemplo com 3 valors per linha)
$query_insert = "INSERT INTO TAB_GARDE_ACT "
."( "
."campo1, "
."campo2, "
."campo3 "
.") "
."VALUES "
."("
."'".$tab[0]."', "
."'".$tab[1]."', "
."'".$tab[2]."' "
.") ";
//Fazer o query (depende do que vc usa Mysql, mysqli, dbp, postgress...)
$result = sql_query($connector,$query_insert);
}
// Fechar documento
fclose($h_src);
You need (normal!) to open the connection to the BDD. If you have a lot of data, you can use a SQL call only. To do this, you need to use mysql_insert_array ().