Please post the code you are having problems with
and add comments or print outs to show the problem you are having.