Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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

DBI quote: invalid number of parameters: handle + 0 Usage: $h->quote($ +string [, $data_type ]) at usersetup2.cgi line 360.
Here is the snippet of code which is affected,

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";<
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.

Thanks for the help!

Ubi Concordia Ibi Victoria

In reply to DBI quote: invalid number of parameters by Baiul

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2022-01-21 23:19 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (59 votes). Check out past polls.