What is the explanation or meaning of this code:
$totalarr = count($opname) - 1;
$totalrows = mysql_num_rows($result);
$trows = $totalrows - 1;
If $opname is an array containing:
['this', 'that', 'other']
$opname is 'this'
$opname is 'that'
$opname is 'other'
The count for the array is 3, as there are three items in the array.
Your code sample is setting $totalarr to the last index number of the array.
With the mysql_num_rows code, similar behaviour is occurring there too.