[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] perl db question, problems when modifying admin
Mike Heins <mheins@redhat.com> writes:
> > Are those functions the sameones as perl's DBI ?
>
> No. But you can get a DBI object with $Sql{table}.
I've had problems with this that I can't explain. I've tried code
list this:
[mvasp tables="products"]
my $phone = $Scratch->{item_code};
my $dbh = $Sql{products} or return "bad DB handle";
my $sth = $dbh->prepare("select * from products where sku='$phone'") or
return "Can't prepare select";
my $rv = $sth->execute();
return "Can't execute select" unless $rv;
my $names = $sth->{'NAME'};
my $numFields = $sth->{'NUM_OF_FIELDS'};
my $rowdata = $sth->fetchrow_arrayref();
HTML "row: $rowdata names: $names num: $numFields";
[/mvasp]
What outputs from this is "row: names: ARRAY(0xXXXXXXX) num: 32".
Note that the $rowdata is blank. Of course, what I'm really wanting
to do is use $sth->fetchrow_hashref(). However, that presents a
problem too. My catalog's error.log reports:
216.23.11.254 YnvnhZCY:216.23.11.254 - [18/February/2002:09:47:41 -0600] digicel /ic/mot-200.html Safe: Can't locate DBI object method "fetchrow_hashref" via package "DBD::mysql::st" at (eval 284) line 15.
So, is there a restriction that Safe puts on the DBI functions? If
so, which ones and why?
--
(__) Doug Alcorn (mailto:doug@lathi.net http://www.lathi.net)
oo / PGP 02B3 1E26 BCF2 9AAF 93F1 61D7 450C B264 3E63 D543
|_/ If you're a capitalist and you have the best goods and they're
free, you don't have to proselytize, you just have to wait.