When I prepare a statement and want to reuse it, do I need to release it in
some way?

My program successfully prepares and executes on a database handle the first
time. But the second time I get "Invalid cursor state".

Here's an example of the code:

$stmtHandleOut = $dbh->prepare("select count(*) FROM table where datadate >=
? and datadate <= ?");

sub mysub()
{
        $stmtHandleOut->execute($StartTime, $EndTime);

        if (($nRecCount) = $stmtHandleOut->fetchrow_array)
        {
                return $nRecCount;
        }
        else
        {
                return 0;
        }
}


Ron Rohrssen

Reply via email to