in reply to if (empty record set)

Try one of the following:

o Test the value contained in $sth->rows. If it is zero then no records exist. IIRC not all DBDs set this correctly.

o if(@bkmark = $sth->fetchrow){ ... }

Cheers,

Logic