$sth = $dbh->prepare( "SELECT username FROM users WHERE username=?" ); $sth->execute(param("username")); if ($sth->fetchrow_array) { error("The username already exists."); }