atEnd() won't be true until after the move next.
I think this code will do what you want:
<?php
$wa_startindex = 0;
while(!$rsStates->atEnd()) {
$wa_startindex = $rsStates->Index;
?>
<?php echo($rsStates->Index == 0?"":","); ?><?php echo($rsStates->getColumnVal("state_abv")); ?>
<?php
$rsStates->moveNext();
}
$rsStates->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount);
?>