Author |
Message |
31/08/2012 23:53:51
|
WeBBy
Beginner
Joined: 31/08/2012 23:47:16
Messages: 6
Offline
|
Have been using your counter for years on many different websites. Just moved them to a new server and apparently mysql.class.php is not compatible with 5.3.
I see you have it your Daily Counter working on your site. Are you using text files or do you have a fix for mysql.class.php.
The total visitors seems to work fine, but daily ....
It logs each visitor as "1" in the database and is not adding them
and then fails to return a value for $visits['visits_today']
thanx
Actually looking at the code, the problem is in counter.class.php
This message was edited 2 times. Last update was at 31/08/2012 23:59:16
|
|
01/09/2012 12:14:09
|
Carbonize
Master
Joined: 12/06/2003 19:26:08
Messages: 4292
Location: Bristol, UK
Offline
|
So have you fixed it?
|
Carbonize
I am not the maker of the Advanced Guestbook
get Lazarus |
|
01/09/2012 15:23:05
|
WeBBy
Beginner
Joined: 31/08/2012 23:47:16
Messages: 6
Offline
|
No, it does not make sense.
The function to update counter is in counter.class.php on line 70.
$this->db->query("UPDATE ".$this->table['total']." set total=total+1"); seems to work
$this->db->query("UPDATE ".$this->table['daily']." SET visitors=visitors+'1' WHERE day = now()"); - does not
echo $visits['total']; works
echo $visits['visits_today']; does not
Cannot figure out why ?????
|
|
01/09/2012 16:44:42
|
Carbonize
Master
Joined: 12/06/2003 19:26:08
Messages: 4292
Location: Bristol, UK
Offline
|
As a test make it echo
"UPDATE ".$this->table['daily']." SET visitors=visitors+'1' WHERE day = now()"
to see what code it is creating.
|
Carbonize
I am not the maker of the Advanced Guestbook
get Lazarus |
|
01/09/2012 17:18:04
|
WeBBy
Beginner
Joined: 31/08/2012 23:47:16
Messages: 6
Offline
|
The way this class is called you cannot echo anything fromit (already tried it).
This is what it is doing...
$this->db->query("UPDATE ".$this->table['daily']." SET visitors=visitors+1 WHERE day = now()");
if ($this->db->affected_rows() == 0) {
// $this->db->query("INSERT INTO ".$this->table['daily']." SET visitors='1', day = now()");
It is running the " if ($this->db->affected_rows() == 0)" and continuously adds a new date and entry of 1. One one site with 10,000 daily visits, I don't even want to mention the database size!
If I comment it out, it stops adding new entries (tried an echo here but not displayed).
The question is, why is it always seeing the "affected rows()==0" ????
You would think that function affected rows was the problem in mysql.class.php but the total update works, i.e.,
$this->db->query("UPDATE ".$this->table['total']." set total=total+1");
if ($this->db->affected_rows() == 0) {
$this->db->query("INSERT INTO ".$this->table['total']." SET total='1', installtime = UNIX_TIMESTAMP()");
In thsi case (total), it is executing the set "total=total+1" and NOT the affected_rows() == 0)
Dont mind saying I am stumped
|
|
01/09/2012 17:29:22
|
Carbonize
Master
Joined: 12/06/2003 19:26:08
Messages: 4292
Location: Bristol, UK
Offline
|
You must be running an old version as I just downloaded the files and the code looks different to what you are posting.
|
Carbonize
I am not the maker of the Advanced Guestbook
get Lazarus |
|
01/09/2012 17:45:36
|
WeBBy
Beginner
Joined: 31/08/2012 23:47:16
Messages: 6
Offline
|
hmmm, website says version 1.1 so I didn't bother to download as my version is 1.1
I think I am going to shoot myself if it is a new version
Will let you know -
|
|
01/09/2012 17:49:33
|
WeBBy
Beginner
Joined: 31/08/2012 23:47:16
Messages: 6
Offline
|
It does appear that the version on the website is NOT version 1.1 but maybe 1.2?
Can't now, but will try it shortly and let you know
|
|
01/09/2012 18:43:21
|
Carbonize
Master
Joined: 12/06/2003 19:26:08
Messages: 4292
Location: Bristol, UK
Offline
|
Yeah since switching to CVS he's had a nasty habit of rewriting things but not updating the version number.
|
Carbonize
I am not the maker of the Advanced Guestbook
get Lazarus |
|
01/09/2012 21:31:56
|
WeBBy
Beginner
Joined: 31/08/2012 23:47:16
Messages: 6
Offline
|
You have no idea how much time I wasted on this. Would probably still be working on it if not for you.
THANK YOU
I have changed the version on all the scripts to version 1.2!!!!
Thank you again
|
|
|