Baiul has asked for the wisdom of the Perl Monks concerning the following question:
Hi all,
I am having great difficulties in getting my script to work with perl/mysql. I am no Guru but basically I am making a registration page for my users and the script just takes their details and inputs them into the mysql DB. I am getting the following error
Here is the snippet of code which is affected,DBI quote: invalid number of parameters: handle + 0 Usage: $h->quote($ +string [, $data_type ]) at usersetup2.cgi line 360.
Basically I got in this mess by trying to escape the characters like @ from screwing up the DB. This is on a paid host and I cannot upgrade the DBI module so I was wondering if anyone had any other ideas? The connection works fine and all of the params are being picked up ok too. They work ok if I just want to print them.my ($nickname, $pass1, $firstname, $lastname, $email, $imtype, $imid, +$info, $country, $homepage) = (. $nickname = $dbh->quote(param('username')),. $pass1 = $dbh->quote(param('password1')), $firstname = $dbh->quote(param('firstname')), $lastname = $dbh->quote(param('lastname')), $email = $dbh->quote(param('email')), $imtype = $dbh->quote(param('imtype')), $imid = $dbh->quote(param('imid')), $info = $dbh->quote(param('info')), $country = $dbh->quote(param('country')), $homepage = $dbh->quote(param('homepage')) ); # Query the database. my $sth = $dbh->prepare( "INSERT INTO member (nickname, password, firs +t_name, last_name, email, country, homepage, im_type, im_id, info) VA +LUES ($nickname, $pass1, $firstname, $lastname, $email, $country, $ho +mepage, $imtype, $imid, $info)"); $sth->execute or die "execute failed: $DBI::errstr\n"; $sth->finish or die "execute failed: $DBI::errstr\n";<
Thanks for the help!
Baiul.
Ubi Concordia Ibi Victoria
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: DBI quote: invalid number of parameters
by Trimbach (Curate) on Feb 23, 2003 at 02:55 UTC | |
Re: DBI quote: invalid number of parameters
by tantarbobus (Hermit) on Feb 23, 2003 at 15:55 UTC | |
by Baiul (Acolyte) on Feb 23, 2003 at 23:54 UTC | |
by Baiul (Acolyte) on Feb 24, 2003 at 04:41 UTC |
Back to
Seekers of Perl Wisdom