Automatic Update the number of lines in txt file

Completed Posted 6 years ago Paid on delivery
Completed Paid on delivery

I'm currently working on a website. There is a page with the codes below and what it does is just output/showing/counting the number of lines in a specific text file.

I want the code below able to update automatically in the webpage without having to refresh the webpage, (let say if I open that textfile and remove 1 line from it, at the same time the number of lines shown in the webpage is also updated automatically without having to refresh it)

I believe AJAX jquery is the answer on how to solve this?

Code:

<?php

$file = basename($_SERVER['PHP_SELF']);

$no_of_lines = count(file($file));

echo "There are $no_of_lines lines in $file"."\n";

?>

Output:

There are 5 lines in [login to view URL]

AJAX JavaScript jQuery / Prototype PHP

Project ID: #16587354

About the project

15 proposals Remote project Active 6 years ago

Awarded to:

justTry

Hi! You are correct, ajax would be the answer, though it couldn't actually 'sense' the file is being edited to fire an update, it would have to do a fire a call either in a regular paced manner, or be triggered in mor More

$15 USD in 0 days
(174 Reviews)
6.1

15 freelancers are bidding on average $22 for this job

abhyasam

Yes without AJAX JQuery we can't solve this. because if you need data without page refresh complasary to use ajax. message me to discuss more. thanks mukesh

$50 USD in 1 day
(65 Reviews)
6.9
configtechnolabs

Hi I can do the job to count number of lines in file in 1 hour. Please share me more details. I have 8 years experience in PHP development. Thanks

$30 USD in 1 day
(110 Reviews)
6.2
ozzy72

Hi, PHP can not dynamically do what you need. You have to use jQuery : Use setInterval to redo things in a loop having certain time gap. And use .load() to load the text file. Regdards, Ozzy

$25 USD in 1 day
(32 Reviews)
5.3
informavenue

Hi, I can do it. My experience on web-dev more then 7 years! ''''''''''''''''''''''''''''''''''''''''''''''''''''

$19 USD in 1 day
(31 Reviews)
5.0
AShegavker

Hello Sir, I read through the details extremely carefully. I am having experience from past 5+ years. Looking forward from your end. Thanks

$17 USD in 1 day
(22 Reviews)
4.8
ScriptsnDesigns

Hi, I can modify your existing PHP Code to Auto Update File line count without page refresh. If you prefer me to do the job kindly award me the project. I can provide the code in some time. Thanks

$20 USD in 0 days
(41 Reviews)
4.6
Corameleviv

Hello Sir, Your project interests me. I will be available to participate in its realization. for more information contact me Zakariaa BENSLIMANE Relevant Skills and Experience Hello Sir, Your project interests me. I w More

$15 USD in 1 day
(13 Reviews)
3.7
navdeepkhera04

Its a very simple task for me i have 5+ year experience in php

$15 USD in 1 day
(2 Reviews)
2.3
sfeuh

hi the script is : $lines = count(file('path_file')); echo $lines; contact me if you have dificulties thank you.

$15 USD in 1 day
(3 Reviews)
1.6
MohamedNaji1994

Hello, do you use any framework in your website? I guarantee that you will find quality in work. I am new in freelancer but i'm Experience in web developing and AJAX. I have worked locally in web developing in se More

$25 USD in 1 day
(0 Reviews)
0.0
amgadtroye

it's super easy i can do it in just one hour or less

$25 USD in 1 day
(0 Reviews)
0.0
ogmemo

I can do this project for you under a day, but you will have to be more specific on it. I will be very interested to work on your project, but you will have to give more details. Relevant Skills and Experience I creat More

$25 USD in 1 day
(0 Reviews)
0.0