Hi Gerald, Try something like
my $sth = $dbh->prepare("insert into bar(group_name,me,daily,item,unit,qty,amount,tax,total) values(?,?,?,?,?,?,?,?,?)"); $sth->execute($group_name,$me,$daily,$item,$unit,$qty,$amount,$tax,$tota l) || die "Cannot execute FIRST Statement!!\n$DBI::errstr"; That is exactly the same format as I have running in a number of scripts. You can check out the documentation at http://search.cpan.org/~timb/DBI-1.47/DBI.pm This has tons of info on how to use the various methods/properties that are available with the DBI interface. I also use an O'Reilly book "Programming the DBI Interface" (I don't have it here so can't refer to the author, I think it is Tim Bunce) If you still have a problem, check your column names etc. to ensure they are correct. I'll have another check tomorrow when I get to work Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -----Original Message----- From: Gerald Preston [mailto:[EMAIL PROTECTED] Sent: Sunday, 27 February 2005 9:43 PM To: Logan, David (SST - Adelaide); 'mysql users' Subject: RE: insert data David, The actual code is uncommented: my $sql = "insert into bar( group_name, me, daily, item, unit, qty, amount, tax, total ) values( ?, ?, ?, ?, ?, ?, ?, ?, ? ) "; Sorry, Jerry -----Original Message----- From: Logan, David (SST - Adelaide) [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 5:09 AM To: Gerald Preston; mysql users Subject: RE: insert data Hi Gerald, If this is copied out of your perl code then you haven't put anything into the $sql variable. Try uncommenting the 2 lines above. Regards David Logan Database Administrator HP Managed Services 148 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -----Original Message----- From: Gerald Preston [mailto:[EMAIL PROTECTED] Sent: Sunday, 27 February 2005 9:33 PM To: mysql users Subject: insert data Hi! 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. Any ideas? Thanks, Jerry -- 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]