First of all, make it clearer by showing the whole code, not separate snippets as you did there ; this will help us understand eventuel placement issues with your variable definitions or errors of such kind. :)