PHP Classes

Error using class

Recommend this page to a friend!

      Counter & visitor statistics  >  All threads  >  Error using class  >  (Un) Subscribe thread alerts  
Subject:Error using class
Summary:Error using method stats->country
Messages:4
Author:matthijs
Date:2005-11-22 20:43:14
Update:2005-11-23 08:50:40
 

  1. Error using class   Reply   Report abuse  
Picture of matthijs matthijs - 2005-11-22 20:43:14
Hi Olaf,
Tested the class and works very well. One error which I can't find the solution for. Thought I might ask you, maybe you will know the answer:
With the example page included in the package I receive the error:
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in
/absolute path etc/httpdocs/inc/classes/count_visitors_class.php on line 115
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in
/absolute path etc/httpdocs/inc/classes/count_visitors_class.php on line 118

It has something to do with the method
$stats->stats_country();
because if I leave that one out of the example I don't receive the error.
All the other methods work perfectly.

Any ideas?

Matthijs

  2. Re: Error using class   Reply   Report abuse  
Picture of Olaf Lederer Olaf Lederer - 2005-11-23 07:43:40 - In reply to message 1 from matthijs
Hello,

I see the problem:

$sql = sprintf("SELECT ip2nationCountries.country AS variable, COUNT(*) AS value FROM %s AS tbl LEFT JOIN ip2nationCountries ON ip2nationCountries.code = tbl.country WHERE tbl.country <> '' GROUP BY tbl.country ORDER BY 2 DESC LIMIT 0,%s", $this->table_name, $limit);

The table names (uppercase C) are different (script en sql data);

I will fix this with the next update.

Olaf

  3. Re: Error using class   Reply   Report abuse  
Picture of matthijs matthijs - 2005-11-23 08:31:32 - In reply to message 2 from Olaf Lederer
Yes, that's it. I didn't spot that typo. Thanks a lot for the fast reply.
Regards, Matthijs

  4. Re: Error using class   Reply   Report abuse  
Picture of Olaf Lederer Olaf Lederer - 2005-11-23 08:50:40 - In reply to message 3 from matthijs
Yes, I tested the class on a windows machine, that's why this bu happend...