Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Re: [Andy] Getting a field as a variable...

Quote Reply
Re: [Andy] Getting a field as a variable... In reply to
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:
Code:
my $table = $DB->table ('Links');
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)

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

Last edited by:

yogi: Jun 18, 2002, 6:40 AM
Subject Author Views Date
Thread; hot thread Getting a field as a variable... Andy 5648 Jun 18, 2002, 5:33 AM
Thread; hot thread Re: [Andy] Getting a field as a variable...
yogi 5504 Jun 18, 2002, 5:57 AM
Thread; hot thread Re: [yogi] Getting a field as a variable...
Andy 5501 Jun 18, 2002, 6:39 AM
Thread; hot thread Re: [Andy] Getting a field as a variable...
yogi 5509 Jun 18, 2002, 6:43 AM
Thread; hot thread Re: [yogi] Getting a field as a variable...
Andy 5518 Jun 18, 2002, 6:45 AM
Thread; hot thread Re: [Andy] Getting a field as a variable...
yogi 5513 Jun 18, 2002, 6:49 AM
Thread; hot thread Re: [yogi] Getting a field as a variable...
Andy 5495 Jun 18, 2002, 7:02 AM
Thread; hot thread Re: [Andy] Getting a field as a variable...
Paul 5543 Jun 18, 2002, 7:12 AM
Thread; hot thread Re: [Paul] Getting a field as a variable...
Andy 5572 Jun 18, 2002, 7:17 AM
Thread; hot thread Re: [Andy] Getting a field as a variable...
Paul 5441 Jun 18, 2002, 7:31 AM
Post; hot thread Re: [Paul] Getting a field as a variable...
Andy 5406 Jun 18, 2002, 7:34 AM