[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] database (DBI) access within a page
On Sun, 2002-11-17 at 23:32, Barry D. Hassler wrote:
> Is it possible to access DBI functions within a page (without usertags, etc)?
> I have a variety of database updates to perform based on a form input, and it seems to make the most sense to do it right within the page (within a [perl] block).
>
> I get "Safe: Can't locate object method "connect" via package "DBI" at (eval 216) line 37."
I have never had much luck using standard DBI functions in
interchange...(not that I have tried to push the issue) Rather, I use
interchange-specific DB querying methods:
my $out = '';
my $db = $Db{$tbl_name};
my $sql = "SELECT $something FROM $somewhere";
my $dbRef = $db->query($sql)
foreach $row (@$dbRef) {
my ($value) = @$row;
$out = $value;
}
return $out;
I use this code in a usertag, so I am not sure if it will work in [perl]
but it will probably work better than DBI->connect(). (remember, going
the route I showed here means you need a mv_asp tag that shares
$tbl_name) Good luck...I hope this helps.
--
-------------------------------------------
| Caleb Phillips |
| The Studio Resource |
| IT Specialist |
| |
| Handcrafted for you in Ximian Evolution |
-------------------------------------------