Gossamer Forum
Quote Reply
Only 2 fields selected?
I'm a little confused about this. I'm using the following codes, to try and grab the data from MySQL for links that has Reciprocal set to 1. I have the following;

Code:
my $table = $DB->table('Links');
my $sth = $table->select( Reciprocal => '1' );

while (my $hit = $sth->fetchrow_hashref) {

use Data::Dumper;
print Dumper($hit); exit;

}

I was having problems showing the $hit->{ID} and $hit->{Contact_Email} variables; so I investigated it more...and it seems to be down to GT::SQL not passing the right values back. The Data::Dumper call gives me;

$VAR1 = { '1' => '1', 'Reciprocal' => 'http://www.free-sex-online-casino.com' };

Anyone seen this before? I'm completly stumped....because to do this intentionaly, I thought you have to define which values you wanted to import?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Only 2 fields selected? In reply to
$table->select({ Reciprocal => '1' });

You are supposed to be passing in a hashref not a hash. A hash is a list, which is basically an array and a list is what is used to specify the columns you want to select, not the where clause.
Quote Reply
Re: [Paul] Only 2 fields selected? In reply to
OMG...how did I not notice that? Think it was one of those mind tricks your brain plays on you, because you can see the ( ) part, and don't think anything of it.

Thanks for that Paul Smile

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!