I am looking for a PHP equivalent to the rs.MoveNext I use in ASP
===

I have only been using PHP for about a week (and even though I have been using ASP for 12 years I am by no means an expert) so please bear with me on this...I am trying to convert my Classic ASP website to PHP.  So far I have been able to find answers to most of my problems but I am stuck on this one.

**I am looking for a PHP equivalent to the .MoveNext function I use in ASP.**

In the example, I have a table with about 450 records and while I want them all to be displayed, I only want there to be 100 per column.  It might not be great code but it works for me.

    set rsSpecial = Server.CreateObject("ADODB.recordset")
    'Grab all the Supporters Names and Website URLs Order by Name
    rsSpecial.Open "SELECT sName, sURL FROM gktwspcf ORDER BY sName ASC", conn
    	if not rsSpecial.EOF then
    		sSpecialFriends = sSpecialFriends & "<table width=" & Chr(34) & "98%" & Chr(34) & ">" & vbCrLf
    		Do
    			i=0
    			sSpecialFriends = sSpecialFriends & "<td valign=" & Chr(34) & "top" & Chr(34) & ">" & vbCrLf
    			sSpecialFriends = sSpecialFriends & "<p>" & vbCrLf
    			Do
    				if rsSpecial("sURL") <> "" Then
    					sSpecialFriends = sSpecialFriends & "<a href='"& Replace(rsSpecial("sURL"), "&", "&amp;") & "' target=" & Chr(34) & "_blank" & Chr(34) & ">"
    					sSpecialFriends = sSpecialFriends & "" & Replace(rsSpecial("sName"), "&", "&amp;") & ""
    					sSpecialFriends = sSpecialFriends & "</a>"
    					sSpecialFriends = sSpecialFriends & "<br>" & vbCrLF
    						'Otherwise just list their name
    				else
    					sSpecialFriends = sSpecialFriends & "" & Replace(rsSpecial("sName"), "&", "&amp;") & ""
    					sSpecialFriends = sSpecialFriends & "<br>" & vbCrLF
    				end if
    				i=i+1
    				rsSpecial.MoveNext
    			Loop Until i=100 or rsSpecial.EOF
    			sSpecialFriends = sSpecialFriends & "</td>" & vbCrLf
    		Loop Until rsSpecial.EOF
    		sSpecialFriends = sSpecialFriends & "</table>" & vbCrLf
    	end if
    rsSpecial.Close
    Set rsSpecial=Nothing


I can't seem to find a good example of how to recreate a nested loop in PHP where I can move to the next record.  This is what I have so far - and it displays each record, 100 times, 100 columns wide.  **I think I need to find somewhere to insert the PHP equivalent of a MoveNext.**

    $result = mysql_query ("SELECT sName, sURL FROM gktw_spcFriends ORDER BY sName ASC", $con) or die(mysql_error()); 
    $sSpecialFriends = "";
    if (mysql_num_rows($result))
    $row = mysql_fetch_array($result);
    	{ 
    	$sSpecialFriends = $sSpecialFriends."<table width=".Chr(34)."98%".Chr(34).">" ."\n";
    		do
    		{
    			$i=0;
    			$sSpecialFriends = $sSpecialFriends."<td valign=".Chr(34)."top".Chr(34).">" ."\n";
    			$sSpecialFriends = $sSpecialFriends."<p>" ."\n";
    				do
    				{
    					//Check for URL
    					if ($row['sURL'] != "")
    					{												
    						$sSpecialFriends = $sSpecialFriends . "<a href='". str_replace("&", "&amp;", $row['sURL']) . "' target=" . Chr(34) . "_blank" . Chr(34) . ">"."\n";
    						$sSpecialFriends = $sSpecialFriends . "" . str_replace("&", "&amp;", $row['sName']) . "" ."\n";
    						$sSpecialFriends = $sSpecialFriends . "</a>" ."\n";
    						$sSpecialFriends = $sSpecialFriends . "<br>" ."\n";
    					}
    					//Otherwise just list their name
    					else
    					{
    						$sSpecialFriends = $sSpecialFriends . "" . str_replace("&", "&amp;", $row['sName']) . "" ."\n";
    						$sSpecialFriends = $sSpecialFriends . "<br>" ."\n";
    					}
    					$i=$i+1;
    				}
    				while ($i<100);
    			$sSpecialFriends = $sSpecialFriends . "</td>" ."\n";
    		}
    		while($row = mysql_fetch_array($result));
    	$sSpecialFriends = $sSpecialFriends . "</table>" ."\n";
    	}
    
    mysql_close($con);


So, if anyone can help me with a PHP equivalent to ASP's MoveNext and/or the best way to accomplish what I am trying to accomplish.

Thank you for any help.


