title: Call two methods of the same class
body: <h2>The goal</h2>
  
  <p>Call two methods of the same class.</p>
  
  <h2>The problem</h2>
  
  <p>I'm getting this error on <strong><code>index.php</code></strong>: </p>
  
  <blockquote>
    <p>Notice: Trying to get property of non-object in [...] on line 3</p>
  </blockquote>
  
  <h2>What's happening</h2>
  
  <p>This is my <strong>index.php</strong>:</p>
  
  <pre><code>&lt;?php
      $dinosaur = new \Animals\Dinosaur;
      echo $dinosaur-&gt;talk()-&gt;opinionAboutSashaGrey;
      echo $dinosaur-&gt;talk()-&gt;opinionAboutLife;
  </code></pre>
  
  <p>And this is the implementation of the methods:</p>
  
  <pre><code>&lt;?php
  
  namespace Animals;
  
  class Dinosaur extends Animal
  {
  
  [...]
  
      public function talk()
      {
          $this-&gt;database-&gt;query("CALL getDinosaurDialogs();");
          return $this-&gt;database-&gt;fetchRowAsObject();
      }
  
  [...]
  
  }
  </code></pre>
  
  <p>And the application always shows just the first message (In this case, the Dinosaur's opinion about <a href="http://en.wikipedia.org/wiki/Sasha_Grey" rel="nofollow">Sasha Grey</a>).</p>
  
  <p>Someone can give me an idea of how can I solve the problem?</p>
  
  <h2>Debug spotlight</h2>
  
  <pre><code>[...]
      var_dump($dinosaur-&gt;talk());
  [...]
  </code></pre>
  
  <p>Returns me <code>NULL</code>.</p>