> -----Original Message-----
> From: Ron Smith [mailto:[EMAIL PROTECTED] 
> Sent: Monday, July 18, 2005 12:50 PM
> To: Perl
> Subject: Error on: my $sth->execute;
> 
> 
> Hi all,
>  
> I'm getting an error when trying to do an INSERT statement to 
> a MySQL database. There's something I'm not understanding 
> here. Can anyone point me in the right direction? I also 
> tried a "do" method, but got the same error. I know the 
> "param" function is loading the values from the form, because 
> I've used a "print" statement to check the variables.
>  
> TIA
> Ron
>  
> ---------------------snip---------------------------
> Software error:
> Can't call method "execute" on an undefined value at 
> C:/www/cgi-bin/load_company_products.cgi line 21.
> For help, please send mail to the webmaster 
> ([EMAIL PROTECTED]), giving this error message and the time and 
> date of the error.
> ---------------------snip---------------------------
> my $sth->execute; <=============line 21

Try ditching the "my".

$sth->execute() or die "Error: $DBI::errstr\n";

> $dbh->disconnect;
> 
> #my $sth->do("INSERT INTO products VALUES ('$sku', 
> '$partNum', '$name', '$descr', '$stockNum', '$qty', '$img', 
> 'vendNum', '$price')");
> ------------snip---------------
> 
> 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to