I have a textfile with lines like the one under..how do i out those values into mysql database and seperate it from the '|'. i have started to write some code but can't get it to work..maybe you can fill in the rest. thanx in advance.
inputfile.txt
1000108|Andy|Test|21 Januari 2002|andreash@algonet.se|looptroop||194.47.143.125|751|20020121||www.lala.com||||||||||||||||||||
<?php
$fd = fopen ("inputfile.txt", "r");
while (!feof ($fd)) {
while ($buffer = fread($fd, 2))
{
if ($buffer=='|') {
$dump = $buffer[i];
$value =
}
}
$sql = "INSERT INTO value (value) VALUES ('$buffer')";
mysql_query($sql);
}
fclose ($fd);
?>