endurox wrote:What does " dim arRev(200,5) " represent?
It just says that aRev is an array and sets its size (VBScript doesn't do dynamically-sized arrays, it seems). PHP it would just be $aRev=array(); and strictly speaking even that's not necessary, since the first time it appears (in that double loop), PHP will know to create an array of arrays to put that string into it.
if ($x/$x <> 0) {
$rows++; // num of rows to be returned
}
This is pretty silly. I presume the original VBScript used \ and not /? The only time $x divided by $x is not going to be 1 is when it's Not A Number - and neither of those are equal to zero.
But all this is really irrelevant. Like I mentioned, PHP's arrays can be resized dynamically. If you want more elements in the array you just put more elements in the array; you don't have to figure out how big the array needs to be in advance, which is what all that code for counting records (doesn't that object provide a method for doing that?) and calculating $rows is doing.
$row = $col = 0;
while(!$rs->EOF)
{
// Whatever you're supposed to do at this point to get a record from $rs.
$arRev[$row][$col] = "(blahblahblah)";
$col++;
if($col==5) // off the end of the row
{
$col=0;
$row++;
}
$rs->MoveNext();
}
And then you can have
echo "<table>";
foreach($arRev as $row) //$arRev is an array of arrays.
{
echo"<tr>";
foreach($row as $item) // $row is an array
{
echo "<td>",$item,"</td>";
}
echo"</tr>";
}
echo "</table>";
If you think possibly having fewer than normal cells in the last table row is tacky, you could have a check within that inner loop to see how many elements $row contains, and echo some "<td></td>" to pad it.