What I am trying to do with $ncount is reset it to 0 each time in the loop. Then I want to do a query on my database to see if the record is there. The result number should be assigned to the $ncount and if the count is gt 0 then do something else something else.
Comment on Re: Re: Reading from databse and writing to file.
What I am trying to do with $ncount is reset it to 0 each time...
You need to separate your count from your sql statement. And you need to prepare, execute, and fetch from your sql statement (you can do all at once, see the selectrow_array method in the DBI docs).