|There's more than one way to do things|
Re: mySQL with Perlby stephen (Priest)
|on Mar 05, 2002 at 23:00 UTC||Need Help??|
To find out if your username exists in the database, you need to make a SELECT query to the database asking for any records with $username in them.
I would suggest that you read some of the tutorials here on DBI:
I would also suggest that you look into using placeholders in your query. Right now, you're interpolating the strings '$username' etc. into your insert statement. While this will work most of the time, someone could enter "T'Pau" as a username, and your insertion statement would be:
which would then be a database error, since the quotation would end after the T. At very least, I'd change it to the following:
You can learn more about this in the abovementioned tutorials.
Update: Added explanation of indirect answer.