Someone tells me that its more practical than storing them in a database, and doing yet another query everytime someone views the page. I believe them. The trouble is its a long while since I stored anything in a text file, and even then, it was just read and write, not select a specific line. Ive dug through google and the manual, but all I found is a headache.
What I want, is a textfile with
ThreadId|Views
and then the current number of views for each thread.
I got as far as
$threadviews_file = "thread_views.txt";
$threadviews_open = fopen($threadviews_file, "r");
$threadviews_read = fread($threadviews_open, filesize($threadviews_file)); //read entire file
fclose($threadviews_open);
echo $threadviews_read;
To read the entire file and echo it out. What I want to do, is select the relevant line, based on thread id, and echo that out. Im also going to want to write to a specific line soon, to update the number of views. and I cant seem to find a decent tutorial on this. Dyou know of any?