Return VS echo. Using return is returing only one value,while echo is echoing all
<p>When I use echo, all the values are displayed,but when i use return only one value is returned in the same while loop.Plz help me.</p>

<p>Here is the php function</p>

<pre><code> function  allcities($mid)
    {

        $sqlc=mysql_query("select * from com2_city where mid='$mid' ");

        while($rowc=mysql_fetch_array($sqlc)) {
            $cities=$rowc['cname'];

            return $cities; //if i use this,then only one value is diplayed
           // echo $cities // if use this ,then function displayed all the values
        }
    }
</code></pre>

<p>I am calling this function in other function of same class as</p>

<pre><code>$sub_cat=mysql_query("SELECT * FROM com4_id WHERE scname='$session-&gt;userid'");

        while($sub_row=mysql_fetch_array($sub_cat)) {
            $cid=$sub_row['cid'];
            $mid=$sub_row['mid'];
             $cities=$this-&gt;allcities($mid);
             echo $cities;
             }
</code></pre>
