I having problems generating an inline substitution.
It works fine when I hard code the entries, but when I call the db and use print to create the exact same string I get the templating error page (which doesn't help me at all). I get the following generic message:
An internal problem was encountered trying to create a requirements object for type Policy_Manuals/content_page
I don't think its the code, since it generates the same xml that I'm hard coding. But here it is:
#!__IW_HOME__/iw-perl/bin/iwperl
use DBI;
my $dbh = DBI->connect('DBI

DBC

river={SQL Server};Server=eclipse;Database=megaform;') or die "Couldn't connect to database: " . DBI->errstr;
my $intBaseID = 3;
my $strSQL = "SELECT DISTINCT services.serviceID, services.serviceDesc FROM services, baseServices WHERE services.serviceID = baseServices.serviceID AND baseServices.baseID = 3 ORDER BY services.serviceDesc";
my $sth = $dbh->prepare($strSQL) or die "Couldn't prepare statement: " . $dbh->errstr;
# Execute the query
$sth->execute() or die "Couldn't execute statement: " . $sth->errstr;
# Read the matching records and print them out
print '<?xml version="1.0" encoding="UTF-8"?>';
print '<substitution>';
while (
@data = $sth->fetchrow_array()) {
print "<option value=\"$data[0]\" label=\"$data[1]\" />";
}
print "</substitution>";
if ($sth->rows == 0) {
print "No names matched.\n\n";
}
$sth->finish;
print "\n";
$dbh->disconnect;
Any thoughts?