$db->do('UPDATE counters SET pagecounter = pagecounter + 1 WHERE pagename = ?', undef, $pagename); #### my $sth = $db->prepare( 'UPDATE counters SET pagecounter = pagecounter + 1 WHERE pagename = ?'); $sth->execute($pagename); #### my ($counter) = $db->selectrow_array('SELECT pagecounter FROM counters WHERE pagename = ?', undef, $pagename); #### sub increase_pagecount_for { my ($db, $pagename) = @_; eval { # Just ignore errors if the record already exists $db->do('INSERT INTO counters (pagename, pagecounter) VALUES (?, 0)', undef, $pagename); }; $db->do( 'UPDATE counters SET pagecounter = pagecounter + 1 ' . ' WHERE pagename = ?', undef, $pagename ); my ($counter) = $db->selectrow_array( 'SELECT pagecounter FROM counters WHERE pagename = ?', undef, $pagename ); return $counter; } ## end sub increase_pagecount_for