I have a file that is comma delimited. I want to open the file, read a line at a time, extract the 10 fields that are separated by commas in each line.
$myFile='ActiveVintageItems4.txt';
$fh=fopen($myFile,'r') or die("Can't Open file");
if ($fh)
{
while (!feof($fh))
{
$line = fgets($fh);
//echo("line = " . $line . "</br>");
$values = explode(',', $line);
$count = count($values);
$valueString='';
for ($i = 0; $i < $count; $i++)
{
$valueString = $values[$i] . ', ';
echo($valueString . "= value string </br>");
}
}
I get 10 fields like i am supposed to, but each field has this character ( � ) between every letter of every word in the field. The value below is supposed to be 1975.
1�9�7�5�
The file that I am working with was exported from SQL Server.
Thank you for any suggestions.