I know this is probably a simple thing to do, but i can't find anything to explain how to do it..
I'm trying to get a comma seperated text file into a database.. each line on the text file is a new entry, and each entry is split into a bunch of different fields using commas.. example:
firstname, lastname, clientID, clients address, usage
firstname2, lastname2, clientID2, clients address2, usage2
firstname3, lastname3, clientID3, clients address3, usage3
now i can read the file easy enough by doing this:
$datalines = file ($filetoread);
foreach ($datalines as $lineoftext) {
echo $lineoftext . "<br>";
}
but how do I get it to actually split up each line so that where i've got:
echo $lineoftext . "<br>";
I can instead put:
echo "First name:" . $field[1] . ", Last name:" . $field[2] . ".";
thanks.