[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[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