I'm not really quite sure what you're trying to accomplish, but this is the way that I normally "traverse" the output of my SQL-query :
<?php
$sql = "SELECT id, attrib FROM table";
$result = mysql_query($sql);
if ($result && mysql_num_rows($result) > 0) {
$rownr = 0;
while($row = mysql_fetch_array($result)) {
$id = $row['id'];
$attrib = $row['attrib'];
// if($rownr >= 10 && $rownr < 20) {
echo "|$id|$attrib|<br>\n";
// }
$rownr++;
}
}
?>
If you uncomment the two commented lines, you'd only get a certain number of rows, but even that can be handled even better using MySQLs own LIMIT. If this doesn't help you on your troubled way, feel free to write me.