The object used:
my $dbh=DBI->connect( 'DBI:mysql:database=club', 'xxx, 'xxxxx', {
PrintError => 0} ) or die $DBI::errstr;
Jerry
-----Original Message-----
From: John Doe [mailto:[EMAIL PROTECTED]
Sent: Sunday, February 27, 2005 6:37 AM
To: [email protected]
Subject: Re: insert data
Hi Gerald
> I am trying to insert data for the first time using MySQL. In Oracle I
> used the following:
>
> # my $sql = "insert into bar( group_name, me, daily, item, unit, qty,
> amount, tax, total )
>
> # values( ?, ?, ?, ?, ?, ?, ?,
> ?, ? ) ";
> my $sth = $dbh->prepare( $sql );
> die $dbh->errstr if $dbh->err;
> $sth->execute( $group_name, $me, $daily, $item, $unit, $qty, $amount,
> $tax, $total ) || die "Cannot execute FIRST Statement!!\n$DBI::errstr";
>
>
> I keep getting "Can't call method "prepare" on an un undefined value. All
> the name listed are correct by looking at MySQLAdmin1.3\4.
Apart from David Logan's answer:
You have to create the $dbh object first (man DBI); the "undefined value" in
the error message refers to that.
HTH
joe
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]