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

How to convert this to a global?

Quote Reply
How to convert this to a global?
How to convert this to a global?



SELECT LinkID,IP,ClickType,ReviewID,Created FROM dir_ClickTrack ORDER BY Created DESC LIMIT 0, 20

I want to do something like:

http://www.gossamer-threads.com/...s/Detailed/1845.html

but to display last 20 clicked links ...

Don't know how. Blush



Thanks in advance.
Quote Reply
Re: [Payooo] How to convert this to a global? In reply to
Could try;

Code:
sub {
my ($output,$sth,$link);
my $search_db = $DB->table('ClickTrack');
$search_db->select_options ('ORDER BY Created DESC Limit 20');
$sth = $search_db->select;

while ($link = $sth->fetchrow_hashref) {

# do whatever you want with the output here...

}
return $output;
}

Not sure why you would want to grab from ClickTrack though, as all that contains is the IP's etc and Link ID's...

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] How to convert this to a global? In reply to
Thanks Andy.

>>>

Not sure why you would want to grab from ClickTrack though, as all that contains is the IP's etc and Link ID's...

>>>

I would like to show last X number of clicked links. (I hope this is the right way, if not - is there some easier solution?) I am using this just for my own info, it is not available to users ...





I am using



sub {
my ($output,$sth,$link);
my $search_db = $DB->table('ClickTrack');
$search_db->select_options ('ORDER BY Created DESC Limit 20');
$sth = $search_db->select;
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link', $link);
}
return $output;
}

I am getting: Unknown Tag: 'Title' Unknown Tag: 'ID' ...



How to "pull" them? (ID's and Titles)
Quote Reply
Re: [Payooo] How to convert this to a global? In reply to
Try

my $search_db = $DB->table('Links','ClickTrack');

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] How to convert this to a global? In reply to
Thanks yogi.

Works fine, Titles and ID's are now ok but I can't order them by Created DESC ...

I can't even figure how they are ordered now Unsure

help ...
Quote Reply
Re: [Payooo] How to convert this to a global? In reply to
Before your ->select call, do:

$search_db->select_options('ORDER BY Created DESC');

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] How to convert this to a global? In reply to
Thanks Alex.

Now it looks like:

sub {
my ($output,$sth,$link);
$search_db->select_options ('ORDER BY Created DESC Limit 20');
my $search_db = $DB->table('Links','ClickTrack');
$sth = $search_db->select;
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link', $link);
}
return $output;
}



And returns : Unable to compile 'TEST':
Quote Reply
Re: [Payooo] How to convert this to a global? In reply to
Because the select_options line needs to go under the line that is defining $search_db Smile

Last edited by:

Paul: Nov 15, 2002, 2:05 AM
Quote Reply
Re: [Paul] How to convert this to a global? In reply to
   

sub {
my ($output,$sth,$link);
my $search_db = $DB->table('Links','ClickTrack');
$search_db->select_options ('ORDER BY Created DESC Limit 20');
$sth = $search_db->select;
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link', $link);
}
return $output;
}

This one displays ID's and Titles OK BUT the links are ordered by ID Frown



Basically, I only need

SELECT Created FROM dir_ClickTrack ORDER BY Created DESC LIMIT 0, 20

and it works great in SQL Monitor, but I also want ID's and Titles Unsure

Heeeelp Tongue