If you are not registered or logged in, you may still use these forums but with limited features. Show recent topics
  [Search] Search   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [FAQ]  FAQ 
[Register] Register / 
[Login] Login 
Daily Counter and php 5.3  XML
Forum Index » Support Forum
Author Message
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

Carbonize
Master
[Avatar]

Joined: 12/06/2003 19:26:08
Messages: 4291
Location: Bristol, UK
Offline

So have you fixed it?

Carbonize
I am not the maker of the Advanced Guestbook

get Lazarus
[Email] [WWW] [Yahoo!] aim icon [MSN] [ICQ]
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 ?????
Carbonize
Master
[Avatar]

Joined: 12/06/2003 19:26:08
Messages: 4291
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
[Email] [WWW] [Yahoo!] aim icon [MSN] [ICQ]
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

Carbonize
Master
[Avatar]

Joined: 12/06/2003 19:26:08
Messages: 4291
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
[Email] [WWW] [Yahoo!] aim icon [MSN] [ICQ]
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 -
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
Carbonize
Master
[Avatar]

Joined: 12/06/2003 19:26:08
Messages: 4291
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
[Email] [WWW] [Yahoo!] aim icon [MSN] [ICQ]
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
 
Forum Index » Support Forum
Go to:   
Based on the open source JForum