I believe this is a concurrency problem...
2 PHP scripts can run at the same time and the problem is that your first
script gets as far as the unlink thus deleting the file. Then the 2nd script
is ran (at the same time) and trys to open the file which doesn't exist,
therefore it reads a num of 0. T
You could be having problems with multiple users, if two visitors come
at the same time file locking problems come into play, one script could
unlink the file at the same time another script tries to open it
resulting in an empty file.
A database would be a better way to do this, but assuming you
ahuh
"Jason Wong" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Thursday 13 February 2003 20:23, Dan Rossi wrote:
> > i mean can u output the counter to the screen with php ? like 1 wait a
few
> > seconds 2 wait a few more seconds 3 etc .., atm it will go t
On Thursday 13 February 2003 20:23, Dan Rossi wrote:
> i mean can u output the counter to the screen with php ? like 1 wait a few
> seconds 2 wait a few more seconds 3 etc .., atm it will go through the loop
> first then output
In theory yes. But it depends on your webserver. Search the archives.
: electroteque
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] counter question
You might still have a buffer at apache or system level, you can try to
output spaces or coments, but I'm not sure something like this is
possible in flash
electroteque wrote:
>hi guys i am trying to increment a counter ec
You might still have a buffer at apache or system level, you can try to
output spaces or coments, but I'm not sure something like this is
possible in flash
electroteque wrote:
hi guys i am trying to increment a counter echoed out to the screen to be
used for flash
for ($i=0; $i < 10; $i++) {
/
> This code is supposed to write a 24h cookie at first visit, and
then
> checks for it at every refresh, if the cookie doesnt exist, it
increases a
> counter on the DB. Simple, right? Then why did it stop working out of
the
> blue? It loops on the refresh, keeps thinking the cookie is not
act
Hi Mike,
I tried the first script you posted on the NG.
This is what happens when I copy and paste your script:
The formbox appears.
I insert a number.
I click submit.
The number reverts back to 0.
The URL script that you sent me works fine.
I'm using MS Win 98/ Apache / PHP 4
Please advise if
I won't keep it up long... but go here... you will see it works...
http://rc.mikeathome.net:8080/test/index.php
*** REPLY SEPARATOR ***
On 04/01/2003 at 7:17 PM Anthony Ritter wrote:
>Michael J. Pawlowsky wrote in message:
>
>> This also works with the ternary operator...
Michael J. Pawlowsky wrote in message:
> This also works with the ternary operator...
.
No dice Michael.
I treid both your scripts.
The formbox comes up.
I enter a number.
I hit submit.
The box clears out the entered number without any mes
This also works with the ternary operator... I don't think it likes the ++ because it
doesn't know the type yet.
$numtoguess)
$message="Your guess was too high.";
else
$message="That is the correct number.";
if(isset($_POST['guess']))
$guess=(int)$_POST['guess'];
else
Use this... enjoy
$numtoguess)
$message="Your guess was too high.";
else
$message="That is the correct number.";
if(isset($_POST['guess']))
$guess=(int)$_POST['guess'];
else
$guess=0;
print_r($_POST);
?>
Guess number:
Type y
www.hotscripts.com
Follow your nose.
Also, Richard's right. This list is for technical problems. If you can't
find it in a search engine, then and only then, ask here.
www.google.com is your god
- amen
- Original Message -
From: "CMS" <[EMAIL PROTECTED]>
To: "PHP General" <[EMA
This list is to answer questions for programming problems.
Write the script yourself. If it fails, post the code and we'll be glad to
help.
sheesh
- Original Message -
From: CMS <[EMAIL PROTECTED]>
To: PHP General <[EMAIL PROTECTED]>
Sent: Friday, April 26, 2002 4:25 PM
Subject: [
On Mon, 8 Apr 2002, Matthew Walker wrote:
> You definitely want to use MySQL for this. Ignore all those people who
> recommended text file DBs. They are /SLOW/. MySQL is very very fast.
I'll echo this. MySQL is hyperoptimized for this sort of transaction. It
already has the databases open so that
g about.
>
> You may well be best off using a database, either
> that or invest some
> serious thought into how you are going to handle
> multiple clients loading
> pages.
>
> Jason
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED
You definitely want to use MySQL for this. Ignore all those people who
recommended text file DBs. They are /SLOW/. MySQL is very very fast. To
show you a small sample of how fast, here's the debug data from one of
my scripts, showing how long the page took to generate, and how many
queries were ru
tiple clients loading
pages.
Jason
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 08, 2002 12:56 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] counter for HIGH traffic site
If it should be fast,
avoid using mysql, just write a file with your numbe
If it should be fast,
avoid using mysql, just write a file with your number,
if there“s a new request, get your number, add one and write it back.
So you avoid mysql-"SQL parsing", opening Database, searching data,
send to process, php putting in var...
just open, read, add, write, close
HTH O
You might also want to setup the table your updating the hits in
as a HASH type table which runs completely in RAM, and as a result
is extremely fast. The only obvious downside, is the data (or hits in this case)
are lost on reboot.
Adam Voigt
[EMAIL PROTECTED]
On Mon, 8 Apr 2002 09:41:39 -0700,
as long as you are only inserting information into the mysql db on each page
load, then you shouldn't have a problem. make sure you keep you indecies
down to a minimum.
Jim Lucas
- Original Message -
From: "Craig Westerman" <[EMAIL PROTECTED]>
To: "php-general-list" <[EMAIL PROTECTED]>
It's very simple - at the top of every page, have a routine that opens a
text file, reads the number inside it into a variable, adds one, and writes
it back out again. If the text file doesn't exist, create it.
Psuedocode:
if (file exists) {
open file for reading;
read contents into $counter
http://php.resourceindex.com/Complete_Scripts/Access_Counters/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
http://www.devshed.com/ClipScripts/results/l_2/c_6/
-Original Message-
From: Zhu George-CZZ010 [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 11, 2001 9:42 AM
To: [EMAIL PROTECTED]
Subject: [PHP] counter using PHP or Javascript?
Hi,
Is there a way to create a counter to count the
of course ;)
try this method:
link to the counter with an IMG from your page
have counter.php increment a log file and
output an image showing the current number
of hits that "pagename" has gotten, so that
the IMG SRC will be digits.
(although, this is like reinventing the wheel,
there are pl
How are you saving the current counter amount?
For instance if it's in a database, add a date field.
Check to see if the date is more than 24 hours old before displaying the
current counter. If it is then update the database and make the counter
number 0. If it's not older than 24 hours, just do
24, 2001 4:26 PM
To: 'PHPBeginner.com'; 'PHP (E-mail)'
Subject: RE: [PHP] Counter Help
Sounds good to me, I should, and will, always keep that in mind. Thanks for
the tips. Also I want to say PHPBeginner.com is starting off very well, keep
up the good work. I've been wat
D]; PHP (E-mail)
Subject: RE: [PHP] Counter Help
Yup, you need to have your key strings in quotes '',
so it doesn't think it's a constant.
ALWAYS use $array['key']
and not
$array[key]
except for the integrers
Sincerely,
Maxim Maletsky
Founder, Chief Developer
]
www.phpbeginner.com
-Original Message-
From: Simon Garner [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 23, 2001 1:32 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Counter Help
From: "Chris Lee" <[EMAIL PROTECTED]>
> change
>
> $row[count]
>
> to
>
> $row['
Yup, you need to have your key strings in quotes '',
so it doesn't think it's a constant.
ALWAYS use $array['key']
and not
$array[key]
except for the integrers
Sincerely,
Maxim Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com
Thank you very much :)
-Original Message-
From: Boaz Yahav [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 23, 2001 4:55 AM
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: [PHP] Counter Help
Fixed.
Sincerely
berber
Visit http://www.weberdev.com Today!!!
To
Fixed.
Sincerely
berber
Visit http://www.weberdev.com Today!!!
To see where PHP might take you tomorrow.
-Original Message-
From: Navid Yar [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 23, 2001 10:39 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Counter Help
Actually, I
ginal Message-
From: Boaz Yahav [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 23, 2001 12:50 AM
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: [PHP] Counter Help
WeberDev will fix it ASAP if you tell it the number of the example :)
Sincerely
berber
Visit http://w
: [EMAIL PROTECTED]
Subject: RE: [PHP] Counter Help
Chris,
It worked! Thanks so much! Weberdev needs to fix it too.
Navid
-Original Message-
From: Chris Lee [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 22, 2001 4:46 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Counter Help
change
or your help and for
Chris' help.
Navid
-Original Message-
From: Simon Garner [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 22, 2001 10:32 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Counter Help
From: "Chris Lee" <[EMAIL PROTECTED]>
> change
>
> $row
From: "Chris Lee" <[EMAIL PROTECTED]>
> change
>
> $row[count]
>
> to
>
> $row['count']
>
> it thinks the work [count] is some kind of conastant, it doesnt know you
> mean (string) 'count'
>
I have noticed a lot of people do not put quotes on their array indexes
(e.g. VBulletin is a prime off
Chris,
It worked! Thanks so much! Weberdev needs to fix it too.
Navid
-Original Message-
From: Chris Lee [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 22, 2001 4:46 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Counter Help
change
$row[count]
to
$row['count']
it
change
$row[count]
to
$row['count']
it thinks the work [count] is some kind of conastant, it doesnt know you
mean (string) 'count'
--
Chris Lee
Mediawaveonline.com
ph. 250.377.1095
ph. 250.376.2690
fx. 250.554.1120
[EMAIL PROTECTED]
""Navid Yar"" <[EMAIL PROTECTED]> wrote in mess
38 matches
Mail list logo