PHP Module - Variable Wont Set

I'm pretty newish to modular programming.

I'm having trouble setting a variable in a module, but only in particular functions.

I have (useless stuff removed):

class Products extends Modules {

  private $resultsFound;

  function __construct() {

  public function getResultsFound() {
    return $this->resultsFound;

  private function setResultsFound($resultsFound) {
    $this->resultsFound = $resultsFound;


I have 2 public functions in the module, both do near enough the same thing, but one will set the var with $this->setResultsFound(12) and one won't.

public function sortSearchBar($categoryID, $brandID, $sort = false, $limit = false, $search = false){
    foreach ($this->sortAwway as $key => $val) {
        $optionItems[] = '<option value="'.$key.'"'. (($sort == $key) ? ' selected="selected"' : '' ) .'>'.$this->htmlspecialchars($val).'</option>';

    foreach ($this->searchLimit as $key => $val) {
        $limitItems[] = '<option value="'.$key.'"'. (($limit == $key) ? ' selected="selected"' : '' ) .'>'.$this->htmlspecialchars($val).'</option>';
    $this->setResultsFound(12); //works

    return '
    <form action=...

public function showProductItemList($categoryID, $brandID = false, $page, $sort = false, $limit = false, $search = false, $cleanURL = true){

    //echo $this->echoArray($this->getProductsForCategory($categoryID, $brandID));
    $q = $this->getProductsForCategory($categoryID, $brandID, $sort, $search);

    $this->setResultsFound(12); //doesn't work

    return $this->formatProductResults($q, $limit, $cleanURL, $page);

Does anyone have any idea why?

Cheers, Rhys


Reading between the lines, I think that the setResultsFound() method should probably be declared protected, not private.

Read this.

Need Your Help

Visual Studio 2010; Tab and indent size should be separate settings as in previous VS versions


I just saw this post on Microsoft Connect(while browsing on /.) about combining tab and indent option into one in VS2010.

svg text animation with delay

javascript svg svg-animate

i want to implement something like this but i want each letter start draw after the finish of the previous. i dont know how to implement this with

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.