17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 865 Views |
-
Count() throwing errors?

21 July 2008 at 7:15am
Hi,
I have about 5 count functions all in the same page controller. They have been working fine for a month or more. Suddenly (without changing the code) the following function crashes the page (with no php-error logs or debug emails being sent)
function CountMembers() {
$GetMembers = DataObject::get("Member", "", "", "", "");
$Result = $GetMembers->Count();
return $Result;Fairly simple. What could cause it to stop working all of a sudden?
-
Re: Count() throwing errors?

21 July 2008 at 9:51am Last edited: 21 July 2008 10:30am
Well, Count() will probably throw an error on a non-object. A better example would be:
function CountMembers() {
$members = DataObject::get('Member');
return $members ? $members->Count() : 0;
}Sean
| 865 Views | ||
|
Page:
1
|
Go to Top |


