Home : Products : DBMan SQL : Discussion :

Products: DBMan SQL: Discussion: Re: [kjetilpalm] Link to record starting with...: Edit Log

Here is the list of edits for this post
Re: [kjetilpalm] Link to record starting with...
Hi,

Follow the following steps:

1. In template global, add the sub-routine:

sub letter_search{
#-----------------------------------------------
#
my $tags = shift;
my $letter = $tags->{letter};
my $sql = $tags->{home}->{sql};
my $db = $tags->{db};
my $table = $sql->table($db);
my $sth = $table->select ( GT::SQL::Condition->new ('Column', 'LIKE', "$letter%"));
my @output;
while (my $hash = $sth->fetchrow_hashref ) {
push @output, $hash;
}
return { letter_loop => \@output };
}

2. in search_results.html, add some scripts:
.....
<%if letter%>
<%letter_search%>
<%loop letter_loop%>
<p><%Dbsql::HTML::generate_search_results%>
<%endloop%>
<%else%>
<%loop results%>
................
<%endloop%>
<%endif%>

3. create a link:
<a href=db.cgi?db=<%db%>&do=search_results......&letter=A>A</a>

Cheers,
TheStone


B.

Last edited by:

TheStone: Oct 17, 2001, 2:15 PM

Edit Log: