Unable to open data file.

\n"); } else { while (!feof ($file)) { $line = fgets ($file, 4096); $lines[] = $line; # echo $line; } $length = count($lines); for ($i = 0; $i < $length; $i++ ){ $line = $lines[$i]; if ($line) { //echo $i . ':' . $line . "\n"; //print_r(explode(":", $line)); list($date, $name, $lat, $long) = explode(":", $line); $loc[$i]["date"] = trim($date); $loc[$i]["name"] = trim($name); $loc[$i]["lat"] = trim($lat); $loc[$i]["long"] = trim($long); } } fclose($file); } return $loc; } // Insert function insertloc($loc, $date, $name, $lat, $long){ // Check for no colons // Check for floats // Check for dup date //if (!array_search($date, $loc)) { //echo "Inserting!\n"; $loc[]= array("date" => $date, "name" => $name, "lat" => $lat, "long" => $long); // } //else { // die("DUPLICATE? Can't have two points for the same day"); //} return $loc; } function viewloc($loc){ // Lets see what we have while (list($key, $value) = each($loc)) { printf("%s:%s:%s:%s\n", $value["date"], $value["name"], $value["lat"], $value["long"]); } } function writeloc($loc, $datafile){ // Newest first arsort($loc); $file = fopen($datafile, 'w'); // Lets see what we have while (list($key, $value) = each($loc)) { $text = sprintf("%s:%s:%s:%s\n", $value["date"], $value["name"], $value["lat"], $value["long"]); fwrite($file, $text); } fclose($file); } //$loc = readloc('../data.txt'); //viewloc($loc); //writeloc($loc, '../data.txt'); ?>