passing variables among methods of a php class
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/12650571/passing-variable-from-one-method-to-another-in-a-php-class">passing variable from one method to another in a php class</a>  </p>
</blockquote>



<p>what is best way to pass  a specific variable among methods of a class,i tried by the following way,but it did not work.wot could b the other possibilities to pass it?plz suggest.thnks</p>

<p>itried to pass the variable $picid;but it did not get passed.</p>

<pre><code>class photos
{

    var $pid;
    function showactivity(){

        $sql = mysql_query("SELECT * FROM activity ");
        while ($row = mysql_fetch_array($sql)) {
            $picid= $row['picid'];
            $this-&gt;pid=$picid;
        }
    }

    function picname(){
        echo $this-&gt;pid;
    }
}

$photo=new photos();
</code></pre>

<p>and in another file i called both variable and method but ,it did not showed any results</p>

<pre><code>&lt;?php $photo-&gt;picname();    ?&gt;   
</code></pre>

<p>and also </p>

<pre><code>&lt;?php $photo-&gt;pid; ?&gt;
</code></pre>
