How about this:
Code:
#!/usr/bin/perl
# Load required modules.
# ---------------------------------------------------
use CGI ();
use CGI::Carp qw/fatalsToBrowser/;
use lib 'admin';
use Links;
use Links:
BSQL;
use Links:
B_Utils;
use Links::HTML_Templates;
use strict;
$|++;
&main();
sub main {
# ----------------------------------------------------
my $in = new CGI;
my $dynamic = $in->param('d') ? $in : undef;
my $letter = $in->param('letter');
my $db = new Links:
BSQL $LINKS{admin_root_path} . "/defs/Links.def";
my $query = qq!
SELECT * FROM Links
WHERE Title LIKE 'a%'
LIMIT 50
!;
my $sth = $db->prepare($query);
$sth->execute();
my $hits = $sth->rows();
my ($link, $output);
while ($link = $sth->fetchrow_hashref) {
$output .= &site_html_link ($link, $dynamic);
}
if ($hits) {
# Print out the HTML results.
&site_html_search_results ( { link_results => $output, category_results => '',
link_hits => $hits, cat_hits => 0, next => '', ignored => ''},
$dynamic );
}
else {
&site_html_search_failure ( { error => "No links found." }, $dynamic);
}
}
Save it as say letter.cgi, and then you can call:
letter.cgi?letter=a
and it will display all links that start with the letter a.
Pugdog, you don't need RLIKE, just use LIKE, it's faster.
Cheers,
Alex
[This message has been edited by Alex (edited December 23, 1999).]