There is no direct MySQL interface in Second Life. It is up to you to write CGI code on the web server that will do these things (or to figure out how an existing web service interface can be utlized to do so).
I can suggest a framework for this, however. It sounds like you need one CGI call that will log a name and return whether that name was already in the database. The URL for such a call might look like:
http://my.domain/path/to/my/script?name=FistName%20LastNameWhere FirstName%20LastName is the full name of the resident, with the space escaped for a URL query parameter. You could have the return value be one of two strings: "inserted" or "duplicate" (or whatever more suitable strings you desire).
The CGI language and library, and the MySQL library you use are going to have to be up to you. You can use SQL statements like:
CREATE TABLE resident_name (name VARCHAR(12

PRIMARY KEY) ENGINE InnoDB;
That creates your table, and only has to be run once when you setup your application. I suggest InnoDB tables because they offer transactions, and if you use transactions, you can get around the case where if your web server allows concurrent requests, you won't get a race condition where two requests both think the name isn't in the database. Then:
SELECT name FROM resident_name WHERE name="...";
Can be used to check whether the name is already in the database (in which case you could simply return your "duplicate" reply). Then to insert a new value, you can do:
INSERT INTO resident_name (name) VALUES ("..."

;
To insert a name that isn't already present. You COULD skip the SELECT and simply try to INSERT, relying on the uniqueness constraint of the primary key to tell you if the name is already present (possibly with INSERT IGNORE and a test on how many rows were inserted, but either way...), but sometimes the reason why an INSERT fails isn't easy to detect, so I would still recommend the transactional approach if it works for you.