passing variable from one method to another in a php class
<p>i am unable to pass the variable from one php method to another in a class</p>

<pre><code>class photos
{

    var $pid;
    function showactivitypics(){

        $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>
