Should be pretty simple;
my $cat_id = $_[0];
my $link_db = $DB->table('CatLinks','Links');
my $limit = $_[1] || 4;
my (@output, $sth);
$link_db->select_options ('ORDER BY RAND()', "LIMIT $limit");
$sth = $link_db->select ( { CategoryID => $cat_id, isNew => 'Yes', isValidated => 'Yes'} );
while (my $hash = $sth->fetchrow_hashref) {
push @output, $hash;
}
$output ? return \@output : return '';
}
Call it with;
<%global_name($ID,4)%>
Hope that helps :)
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!
Code:
sub { my $cat_id = $_[0];
my $link_db = $DB->table('CatLinks','Links');
my $limit = $_[1] || 4;
my (@output, $sth);
$link_db->select_options ('ORDER BY RAND()', "LIMIT $limit");
$sth = $link_db->select ( { CategoryID => $cat_id, isNew => 'Yes', isValidated => 'Yes'} );
while (my $hash = $sth->fetchrow_hashref) {
push @output, $hash;
}
$output ? return \@output : return '';
}
Call it with;
<%global_name($ID,4)%>
Hope that helps :)
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!