Gossamer Forum
Home : Products : DBMan SQL : Discussion :

How make a "next record"-link?

Quote Reply
How make a "next record"-link?
How do I make a "next-record" link on the resultpage when a record is displayed?

Kjetil
..........................
Kjetil Palmquist
www.svanger.com
Quote Reply
Re: [kjetilpa] How make a "next record"-link? In reply to
Hi Kjetil,

You might pass a param i.e. next_page=ID+1 to your detail page of a record using variable <%last%> inside the loop of your search_results:

<%loop results%>

.....

your link to detail page &<%ifnot last%>next_page=<%ID+1%><%endif%>&param..

.....

<%endloop%>

After that, you can add a new link to next record:

<%if next_page%>
db.cgi?db=your_table&do=search_results&ID=<%next_page%>&ID-opt==....
<%endif%>


Cheers,
Jean(at)Gossamer Threads Inc.

Notes: You can use the following tags inside a loop:
<%row_num%> - a counter for what row is being looped, starts at 1.
<%first%> - boolean that is true if this is the first row, false otherwise.
<%last%> - boolean that is true if this is the last row, false otherwise.
<%inner%> - boolean that is true if this is not first and not last.
<%even%> - boolean is true if row_num is even.
<%odd%> - boolean is true if row_num is odd.

Quote Reply
Re: [jean] How make a "next record"-link? In reply to
Hi Jean!
I am trying to do this linking (going from the display on one detailed record straight to next deatiled record) but something is amiss. Implementing your suggested code, when in the first list of records generated by search_results page indicates that 'ID+1' is an "unknown tag". ie
http://...cgi-bin/db.cgi?do=search_results&next_page=Unknown%20Tag:%20'ID+1'&db=articles&details=1&ID=11&ID-opt==
and I of course get no detailed page.
Does this next_page have to be declared as a global ? Could you be more explicit? Thanks very much for your advice.
Charly
Quote Reply
Re: [charly] How make a "next record"-link? In reply to
Jean !!!
Eureka !
The correct code is ...next_age=<%ID + 1%>.... and not <%ID+1%> as you wrote! Perl likes the spaces ! Now it works !!!
Thanks
Charly
Post deleted by charly In reply to
Quote Reply
Re: [charly] How make a "next record"-link? In reply to
Hi Charly,

Can you check my code to see if I'm doing this right?

<tr>

<%next_page = ID + 1%>

<%prev_page = ID - 1%>

<%ID%>




<td width="50%"><%ifnot first%><a href="db.cgi?db=customerCases&do=search_results&detail=1&recordno=<%prev_page%>&recordno-opt==">previous record</a><%else%><%endif%></td>

<td width="50%">

<p align="right"><%ifnot last%><a href="db.cgi?db=customerCases&do=search_results&detail=1&recordno=<%next_page%>&recordno-opt==">next record</a><%else%><%endif%></td>

</tr>



Does ID represent the db_key?

Thanks!




Reena