oh shite son!
I already did the a+, however that was not the problem. I was quite drunk at the time of writing this program, and I had each line setting the $fp off like so:
$fp=fopen($file, "a+");
$fp=flock($fp, LOCK_EX);
$fp=fwrite($fp, $name.",".$number."\r\n", 1024);
$fp=flock($fp, LOCK_UN);
$fp=fclose($fp);
when the correct method of writing to files is this:
$fp=fopen($file, "a+");
flock($fp, LOCK_EX);
fwrite($fp, $name.",".$number."\r\n", 1024);
flock($fp, LOCK_UN);
fclose($fp);
however, this did fix my problem, I have another question, how to I alphabetically sort the names to their numbers, this is my current displaying code:
function filelist($file){
$link=file($file);
$i=0;
//$link=sort($link); //WILL NOT SORT, spits out error with it uncommented.
echo "<table border='1'>";
while($i<=sizeof($link) - 1){
list($name, $number)=split(",", $link[$i]);//make the variables
echo "<tr>
<td>".$name."</td><td>".$number."</td>
</tr>";
$i++;
}//loop to get the contents of the comma delimited file
echo "</table>";
return true;
}//function to read the PHONEBOOK