"R. Joseph Newton" <[EMAIL PROTECTED]> wrote: A L wrote:

> Hi Everyone at [EMAIL PROTECTED],
> Threre are two main questions:
> 1. How can I get to make results from mysql db to be displayed on web browser with 
> pagination? Meaning, when there are too many results from the db, it only displays 
> 20 results at a time-like that of google-and show links to rest of the results by 
> giving page numbers. I've used Data::Page module from CPAN, but I can only get it to 
> print out the result to the web statically without giving links to other pages and 
> all the results are still displayed on one page when there should be 33 pages or 
> more (the total pages number changes as more stuff are added to the db). Also, 
> DBIx::Pager from CPAN was looked (I'm still working on it to work), but it doesn't 
> seem like it is not going to do what I'm expecting. Am I looking at the right 
> places? If not, will you tell me what I should be looking at?

Try this:

Save the whole result set to a local temp file. You'll need a routine for generating 
the temp file, and the folder should be used only for the temp files from your 
program, since you'll want to routinely unlink all files older than an hour or two.

Read the file twenty or so lines at a time, doing nothing but getting the line, then:
$offsets{$row_number} = tell DB_FILE;
for each set of twenty. Store these offsets in a file as a set of name-value pairs
1=0 # trivial
21=1567 # not so trivial

You can open up and slurp the index file each time the user responds with a click on 
the Next or Previous link. Your script should write the value for which is the current 
result set in the links for this information. they should probably activate the submit 
command of some form, though so that they use POST when sending data to the server.

Don't expect to find all your answers here in one place. The project you are taking on 
involves three distinct sytems at least--the web server, the clients browser 
environment, and the database engine. Each has its own rules and its own modus 
operandi.

###Lots of things that you have mentioned have to be looked up.  But, I do appreciate 
more possibilities of doing one thing in diffrerent ways.

snippet>
>
> Okay, I'm not sure if I should insert my codes here because I haven't yet tried 
> something that would do what I want to do. But, if you think that will help you 
> understand my questions better, I will do so. Thanks for your time.
>
> Angela

For the kind of thing you want to do, you will probably have to use Javascript. There 
are lists and groups available to help with the client-side issues. We can help with 
some of the general Perl programming issues. The folks at beginners-cgi group can help 
with more specific questions about server-side programming.
###I'll post more specific cgi questions at beginners-cgi group.  However, I do see 
some people who are here are there as well:)


What is your overall Perl background? Have you studied the basic concepts of 
command-line programming with Perl? If not, you should make sure that you get some 
basic training in Perl before trying to build an online data access system.

Joseph
###My background...  Well, I had my first encounter with Perl in the Fall of 2000.  It 
was not pretty.  At the time, my only programming experience was Pascal taken as a 
high school student.  However, I really wanted to learn programming better, and was 
told that Perl is the language to learn to get things done.  But, I hated Perl the 
first time because I had a huge issue with debugging when it won't let me do things 
because I missed a period or something important, which I was unaware of.  Then, I 
learned a little bit of Java.  I liked Java with all its structures and class less 
than I did Perl.  Now, I'm trying to master Perl to an extent where I feel comfortable 
enough to create things I want to create without feeling at a total loss or 
frustration to call a computer stupid for not doing what I had written.  Also, I'm 
using Linux.  So, to answer your question about studying the basic concepts of 
command-line programming with Perl, I think that I do know a little bit to test my
 codes, but I do have my Perl reference manuals beside me to look up things whenever 
necessary, as I am always learning something new and cool.

Angela


---------------------------------
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard

Reply via email to