[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] SQL Query in UserTag
Try this to get a handle on your database:
my $db = &Vend::Data::database_exists_ref('framestyles');
my $dbh = $db->[$Vend::Table::DBI::DBI];
unless ($dbh) {
&Log("Unable to get DB handle framestyles: $!\n");
return;
}
Bill Carr
Worldwide Impact
bill@worldwideimpact.com
413.253.6700
"Ben Mirecki" <ben@quadrantfive.com>
Sent by: interchange-users-admin@developer.akopia.com
05/14/2001 10:21 AM
Please respond to interchange-users
To: <interchange-users@developer.akopia.com>
cc:
Subject: [ic] SQL Query in UserTag
Hi!
I'm trying to create a UserTag that does a field value lookup from an
arbitrary table. The UserTag will be called from CommonAdjust as part of
the
pricing method.
Here's the code I have.
UserTag calc_price Order
UserTag calc_price Routine <<EOR
sub {
my $dbh = $Sql{framestyles};
my $sql_query = "SELECT price FROM framestyles WHERE sku = 9848";
my $sth = $dbh->prepare($sql_query) or return error_message("Error...");
my $rc = $sth->execute() or return HTML("Error...");
return 0;
}
EOR
Ignore the return value for now. Simply trying to execute the query, I get
the following error message:
Runtime error: Can't call method "prepare" on an undefined value at (eval
227) line 5.
Any idea why is this happening?
Thanks,
Ben
_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users
_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users