in reply to mySQL with Perl
I would suggest that you read some of the tutorials here on DBI:
(I'm refraining from answering the question directly because I believe you'll find learning the answer from the tutorials more rewarding in the long term.) :)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:...Values ('T'Pau'...
You can learn more about this in the abovementioned tutorials.$query = qq(insert into members (username, password, email, name, url, + date) Values (?, ?, ?, ?, ?, ?)); $sth = $dbh->prepare($query); $sth->execute($username, $password, $email, $name, $url, $time) or die + "Error in execution: $DBI::errstr";
stephen
|
|---|