my $sth = $db1->prepare( "SELECT count(*) FROM users WHERE username = ?" ); $sth->execute($Username_POST); my $rs = $sth->fetchall_arrayref(); my $count = $rs->[0]->[0];