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.

> 2.  I'm trying to creat the select all button and deselect all button in one button. 
>  Meaning, when I click on the button, it selects all the checkboxes displayed  and 
> turns to deselect all button; when I click on the button, again, with all the check 
> boxes checked, I uncheck all the boxes and return the button to select all button.  
> When I search for this on the web, most of them give javascript results.  I would 
> like to use Perl.  Is it possible to do this with Perl?  If so, what should I be 
> looking at?  At CPAN, only thing that results is toc and cgi where I couldn't get 
> what I'm looking for?  Have I not looked carefully and missed something?

As others have pointed out, Perl operates on the server.  for good reasons, content 
providers on the Internet to not have access to high-end APIs on the client side.  
Basically, that is the business of the owner of the client machine.
Browsers provide Javascript and the Java Virtual Machie as safely-circumscribed 
environments where web pages can run those functions necessary to properly display 
their content, without exposing the sytem to external attack.

>
>
> 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.

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



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to