I did not test this, but give it a try.
$count = 0;
$id = 98237592;
$record = array();
while( $row = mysql_fetch_object( $query ) )
{
++$count;
if( $row->fieldName == $id )
{
$record[$count] = $row['fieldname'];
print 'Record Number: ' . $count;
}
// Other code here
}
Again, I did not test it, but just adapt it to your scenario.
And to see the array contents, just do...
echo '<pre>';
print_r($record);
echo '</pre>';
Good luck,
Don