For Loop keeps returning same value
<p>Am using a For loop to return all rows from table. It goes through each row properly but keeps returning the same value even though it has gone on to the next row.</p>

<p>Code Below:</p>

<pre><code>function setLayer($result_set, $row){

    $str  = "MyMap_".mb_convert_encoding(mssql_result($result_set, $i, 0),"UTF-8","SJIS")."_".mb_convert_encoding(mssql_result($result_set, $i, 1),"UTF-8","SJIS");
    return "".$str." = new OpenLayers.Layer.WMS( \"".$str."\",\"http://192.168.0.69/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/mapserver/data/toyama/toyama_mymap.map&amp;service=WMS&amp;SRS=EPSG:2449&amp;VERSION=1.1.1&amp;format=image/PNG&amp;layers=".$str."\", {'layers': '".$str."'},  {isBaseLayer: false, visibility: false,opacity:0.5,alpha:true});
    map.addLayer(".$str.");\n\n";
}
</code></pre>

<p>Loop:</p>

<pre><code>for($i=0; $i&lt;=$group_layer_row; $i++){
    echo setLayer($rs_group_layer, $i);
}
</code></pre>

<p>My reasoning is that though the loop goes through all the rows, $str does not change to reflect another row so it keeps giving the same value though it the row value is different.... close? </p>

<p>Hope someone can help me with this. Thank you.</p>
