$sth = $dbh->prepare("INSERT INTO users(
id,
username, password,
first, last,
email, phone,
address,
city, state, zip,
country,
s_address, s_city, s_state, s_zip, s_country,
intrests) VALUES ('', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
$sth->execute(param('first'), param('last'),
param('username'), param('password'),
param('repass'),
param('email'), param('reemail'),
param('phone'),
param('address'), param('city'),
param('state'), param('zip'), param('country'),
param('s_address'), param('s_city'),
param('s_state'), param('s_zip'),
param('s_country'));
####
my @columns = qw(username password first last email phone
address city state zip country
s_address s_city s_state s_zip s_country
intrests);
# There are more elegant ways to build this, but this is
# a step-by-step way :
my $sql_columns = "id";
my $sql_values = "''";
foreach @columns {
$sql_columns .= ", $_"; # Add the column name
$sql_values .= ", ?"; # And add a parameter to the query
};
$sth = $dbh->prepare( "INSERT INTO users($sql_columns) VALUES ($sql_values)");
# Now extract each CGI parameter, and store the values in @formvalues
my @formvalues = map { param( $_ ) } @columns;
$sth->execute(@formvalues);
####
perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The
$d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider
($c = $d->accept())->get_request(); $c->send_response( new #in the
HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web