Quoting Greg McClure <[EMAIL PROTECTED]>:
> However, when I try to run this code:
> 
> * <%init>
> *     use DBI;
> *     my $dbh = DBI->connect("DBI:mysql:remembering", "root", "");
> *     my $sth = $dbh->prepare("insert into users
> *                                      (username, password, firstname, lastname)
> *                                      values ('Bob', 'abc123', 'John', 'Doe')");
> *
> *     $dbh->execute;
> * </%init>
> 
> I get this error:
> 
> Can't locate object method "execute" via package "Apache::DBI::db" at
> /var/www/clients/remembering/users/new_user_submit.cmp line 8.

Just a simple little DBI mistake that you made.  execute gets called on $sth
(statement handle), not on $dbh (database handle).  Just think of it as wanting
to execute the SQL statement that you just prepared.

See the DBI docs for more info.

Cheers,

Cees

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html

Reply via email to