Here's the deal. I am trying to read values from a text file that I have logging data from each user on my website. The problem is, the code Im using from here on Stack is causing an infinite loop of errors which is ultimately causing my server to run out of resources.
Im using PHP and here is the code to display the data to my google chart:
$file = 'playerlogs/'.$username.'_balance.txt';
$lines=array();
$fp = fopen($file, "r");
while(!feof($fp))
{
$line = fgets($fp, 4096);
array_push($lines, $line);
}
fclose($fp);
The error Im getting:
fgets() expects parameter 1 to be resource, boolean given in graph.php on line 44
feof() expects parameter 1 to be resource, boolean given in graph.php on line 42
I am fairly new to PHP so if you could help explain your answer with an example of how the code should look I would really appreciate it.