in reply to undefined array use

A side note: Since you're not making use of bind variables and are putting a variable directly into your SQL, be sure that you've sanitized $username. Don't let me put a single-quote in there and let me add arbitrary SQL to make your script do whatever I want. If you're basing this on DBI, a better approach might be something similar to this:
$sth = $dbh->prepare('select oid,* from timeclock where end_stamp is n +ull and username=?') or die "prepare: $DBI::errstr"; # for each username { $sth->execute($username) or die "execute: $DBI::errstr"; # now do whatever with $sth->fetchrow # }