You can always use the $DB object in your plugins, i.e. you don't need to create a new GT::SQL object.
So you could do:
my $url;
if (my $sth = $table->select( { ID => $id }, ['URL'] )) {
$url = $sth->fetchrow;
}The hashref in the select statement is your condition, the arrayref lists the field you want to get.
in general, you can use the following statements, depending on what you put into select (not sure if the list is complete)
$sth->fetchrow_array;
$sth->fetchrow_hashref;
$sth->fetchrow_arrayref;
$sth->fetchall_arrayref;
$sth->fetchall_hashref;
$sth->fetchall_list;
Ivan
-----
Iyengar Yoga Resources / GT Plugins
So you could do:
Code:
my $table = $DB->table ('Links'); my $url;
if (my $sth = $table->select( { ID => $id }, ['URL'] )) {
$url = $sth->fetchrow;
}
in general, you can use the following statements, depending on what you put into select (not sure if the list is complete)
Code:
$sth->fetchrow; $sth->fetchrow_array;
$sth->fetchrow_hashref;
$sth->fetchrow_arrayref;
$sth->fetchall_arrayref;
$sth->fetchall_hashref;
$sth->fetchall_list;
Ivan
-----
Iyengar Yoga Resources / GT Plugins