Gossamer Forum
Quote Reply
Has_priority global
Hi

I am using Recie_link plug in and I am trying to pull a list of all links with Has_priority set to Yes:

sub {
# Displays the priority links on the home page.
my ($output,$sth,$link);
my $search_db = $DB->table('Links');
$search_db->select_options ('ORDER BY Add_Date DESC Limit 50');
$sth = $search_db->select ( { Has_Priority => 'Yes' });
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link_short', $link);
}
return $output;
}

For some reason it is returnning links those have it set to No as well ?
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] Has_priority global In reply to
Looks exactly like the one I use, the only difference is the ORDER BY.
May have to check the Has_Priority Yes No options.

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

Regards

minesite
Quote Reply
Re: [minesite] Has_priority global In reply to
Thanks

I have tried that but still getting a list of over 100 links, although I have less than 10 links with Has_priority equal Yes. Mad
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] Has_priority global In reply to
Thinking about it, I did have a similar problem so I took out the No from the Has_Priority options, so it was either Yes or blank.
Try that and see how it goes.

Form Names
(Stored in Database)
Only for checkbox, multi-select or radio forms. Yes
Form Values
(Displayed on Form)Only for checkbox, multi-select or radio forms. Yes

Regards

minesite
Quote Reply
Re: [katabd] Has_priority global In reply to
Hi. You could try changing;

$sth = $search_db->select ( { Has_Priority => 'Yes' });

to

$sth = $search_db->select ( { Has_Priority => 'yes' });

I'm still on vacation, so don't have access to the plugin I'm afraid. I seem to remember it being all lowercase, so "Yes" and "yes" would be classed as different things Frown

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: [katabd] Has_priority global In reply to
Also, try doing this;

$search_db->select_options ('ORDER BY Add_Date DESC Limit 50') || return $GT::SQL::error;
$sth = $search_db->select ( { Has_Priority => 'Yes' }) || return $GT::SQL::error;

That way, you should get an error message if your syntax is wrong.

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!