The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Perl Programming
|
Next/Previous Links in Perl
Discuss Next/Previous Links in Perl in the Perl Programming forum on Dev Shed. Next/Previous Links in Perl Perl Programming forum discussing coding in Perl, utilizing Perl modules, and other Perl-related topics. Perl, the Practical Extraction and Reporting Language, is the choice for many for parsing textual information.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

July 6th, 2000, 10:56 AM
|
|
Junior Member
|
|
Join Date: Jul 2000
Posts: 6
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Looking for some information on how I might code next and previous links. Have a number of titles pulled from a database and would like to give users the ability to go through each title one by one. At the moment, I have next 10 and previous 10 working. How would I go from one to the next one.
Anybody???
------------------
Rosie
|

July 6th, 2000, 11:57 PM
|
 |
.Net Developer
|
|
Join Date: Feb 2000
Location: London
Posts: 987
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 14
|
|
|

July 7th, 2000, 02:35 AM
|
|
Junior Member
|
|
Join Date: Jul 2000
Posts: 6
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Thanks Shiju. I had already found that script before I posted my query but hadn't had a chance to try it out. I'll do that this morning and let you know how I get on.
------------------
Rosie
|

July 7th, 2000, 11:09 AM
|
|
Junior Member
|
|
Join Date: Jul 2000
Posts: 6
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|

July 7th, 2000, 11:12 AM
|
|
Junior Member
|
|
Join Date: Jul 2000
Posts: 6
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Shiju,
I can see how that code works but can't quite figure out how to adapt to my needs. Not been programming very long!!
I have approx 2000 records in a database which a user can select to view in blocks of 5 or 10 then view next 5 or 10 and so on. I need a link at the top of the record allowing them to move on to the next one record and not the next 5 or 10. I can see how you are deciding how many pages require a link but I seem to be bringing up a few hundred with a link to the next few hundred at the bottom.
What am I doing wrong or not seeing??? Think its too late on a Friday afternoon to think too deeply!!
------------------
Rosie
|

July 8th, 2000, 01:01 AM
|
 |
.Net Developer
|
|
Join Date: Feb 2000
Location: London
Posts: 987
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 14
|
|
Rose ,
i'll help you to sort it out your problem..
<<
I need a link at the top of the record allowing them to move on to the next one record and not the next 5 or 10.
this i'm not clear.....
but I seem to be bringing up a few hundred with a link to the next few hundred at the bottom.
ok..but it may take sometimes to populate on the screen...
Can you tell me the details ,how you want to display the records? or you may post your code ,i'll edit it and give back to you..
Tell me which database you are using for saving records?..
If you are using mysql ,then your job is very easy especially becoz you can use LIMIT clause in the select statement....
------------------
SR -
webshiju.com
"The fear of the LORD is the beginning of knowledge..."
|

July 8th, 2000, 02:21 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
i m also closely watching whts going on here.
b'cos im doing this project now ..
I modified something in The Program given by Shiju and it is working well and fine.
vijay
|

July 8th, 2000, 04:14 AM
|
|
Junior Member
|
|
Join Date: Jul 2000
Posts: 6
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Hi Shiju.
Here is exactly what should happen. On the first search form, a user enters a date and a few other relevant details. Clicks the search button. The mysql database is searched and brings out a list or records according to the date the user entered. These records at that point are displayed in a table by the title of the record only as a hyperlink. The user clicks on the title he wants to view and the whole record is displayed on the next page. At the top of that page are links for next and previous searches. The next search takes the user back to the original search form to allow him to carry out the search again. The previous search takes him back to the form with the previous search terms already entered allowing him to amend one or more of them. And the other link is for next and previous blocks. ie, if he clicks Next he can view the next 5 block of records. If he clicks previous, he can view the previous 5. However, I also want to include another next link which will allow the user to move on to the next record and then the next, one at a time. So if he is currently viewing record number 1250, he can click next and move on to 1251 or back to 1249. Does this all make sense?
You've been a great help so far and I really appreciate. I sit here on a Saturday morning when I would much rather be home relaxing!!
Thanks again.
------------------
Rosie
|

July 8th, 2000, 05:15 AM
|
 |
.Net Developer
|
|
Join Date: Feb 2000
Location: London
Posts: 987
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 14
|
|
yea Rose!!,
I understand what you are explaining above.It can be done..Explainig the logic will take few minutes.Now i am involved in some urgent Java projects.
Tommorow(Sunday) after charch i'll get some free time,then i'll explain you the complete logic how you can implement this very easily..
<<
I sit here on a Saturday morning when I would much rather be home relaxing!!
>>
Saturday must be a holiday for you.But you know,we'll have to work 6 days here in India.Sunday will go with full time church activities...so no free time at all..
------------------
SR -
webshiju.com
"The fear of the LORD is the beginning of knowledge..."
[This message has been edited by Shiju Rajan (edited July 08, 2000).]
|

July 9th, 2000, 03:47 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Your Requirement is simple and easily can done .
this is the program logic you have to do ...
1.Have you designed the HTML form?
2.Write the CGI to take all the parameters..
3.This will the program flow..
#!usr/bin/perl
use CGI;
use DBI;
$q = new CGI ;
$dsn = "dbi:mysql:database";
$user = "name";
$pwd = "password";
# Get all the values from the form ..
$day = $query->param('day');
#connect to the DB
my $dbh = DBI->connect($dsn,$usr,$pwd) | | die "Connecting Error!";
my $sql = qq { select * from database where constraints };
my $sth1 = $dbh->prepare( $sql );
my $numrows = $sth1->execute;
# Now $sth1 will contain the results ..
# Process the Results
while ($sth1->fetchrow_array)
{
#print the results here
}
------
this is the simple program that will do the interface ...
Do practice this then practice the program in
previous one ...given by shiju.
all the best
vijay
|

July 11th, 2000, 02:43 AM
|
|
Junior Member
|
|
Join Date: Jul 2000
Posts: 6
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Thanks Vijay. However, that part of the program is already working!
------------------
Rosie
|

July 11th, 2000, 02:53 AM
|
 |
.Net Developer
|
|
Join Date: Feb 2000
Location: London
Posts: 987
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 14
|
|
Rosie,
<<However, that part of the program is already working!>>
Then where you are stucking up?
---
------------------
SR -
webshiju.com
"The fear of the LORD is the beginning of knowledge..."
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|