I need help!!
$headings = array();
$listings = array();
$handle = fopen(LOCAL_WORKING_DIR ."listings-single family.txt","r") or die("trouble");
$line = fgets($handle, 4096);
if(!feof($handle))
{
$headings = explode("t", $line);
}
$line = fgets($handle, 4096);
while(!feof($handle))
{
$pieces = array();
$pieces = explode("t", $line);
$a = count($headings);
$b = count($pieces);
if($a < $b)
{
if($dataToggle == true)
{
$dataToggle = false;
echo "<span style="color: red;">There is a problem with the data in " . substr($file, 0, -3) . "! Attempting to Reslove!</span><br>n";
}
$c = $b - $a;
for($t=0; $t<$c; $t++)
array_push($headings, " ");
}
if($a > $b)
{
if($dataToggle == true)
{
$dataToggle = false;
echo "<span style="color: red;">There is a problem with the data in " . substr($file, 0, -3) . "! Attempting to Reslove!</span><br>n";
}
$c = $a - $b;
for($t=0; $t<$c; $t++)
array_push($pieces, " ");
}
$temp = array_combine($headings, $pieces) or die('Fatal Error: corrupt data in file ' . substr($file, 0, -3));
if(strcmp(CLIENT_OFFICE, $temp["List Office"]) == 0)
{
array_push($listings, $temp);
}
$line = fgets($handle, 4096);
}
}
echo "Succesfully processed data in file " . substr($file, 0, -3) . "<br>n";
}