array reference question

Discussion in 'Perl Misc' started by yeti349@yahoo.com, Sep 6, 2005.

  1. Guest

    Hi. I have a html form that queries a database and stores the results
    into @results. The query results are then displayed on a "results page"
    that contains common features like sorting by column, change the number
    of records displayed per page, etc... Currently, when the user clicks
    on one of these features on the results page, the query parameters are
    passed via url and the script is run again providing the requested
    changes. My question is this: Is it possible, when the user first
    submits the query form, to create an array reference (my $results_ref =
    \@results; my @new_results = @$results_ref;) and then use this
    reference when the results page features are clicked. Therefore
    @new_results (containg @results data) will be modified? Does this make
    sense? Thanks for any help...
     
    , Sep 6, 2005
    #1
    1. Advertising

  2. John Bokma Guest

    wrote:

    > Hi. I have a html form that queries a database and stores the results
    > into @results. The query results are then displayed on a "results page"
    > that contains common features like sorting by column, change the number
    > of records displayed per page, etc... Currently, when the user clicks
    > on one of these features on the results page, the query parameters are
    > passed via url and the script is run again providing the requested
    > changes. My question is this: Is it possible, when the user first
    > submits the query form, to create an array reference (my $results_ref =
    > \@results; my @new_results = @$results_ref;) and then use this
    > reference when the results page features are clicked. Therefore
    > @new_results (containg @results data) will be modified? Does this make
    > sense? Thanks for any help...


    CGI is stateless in itself, so you have to store the result somewhere
    (which might make things cumbersome). Oh, and please let the database do
    the sorting, not Perl.

    --
    John Small Perl scripts: http://johnbokma.com/perl/
    Perl programmer available: http://castleamber.com/
    Happy Customers: http://castleamber.com/testimonials.html
     
    John Bokma, Sep 6, 2005
    #2
    1. Advertising

  3. Guest

    wrote:
    > Hi. I have a html form that queries a database and stores the results
    > into @results.


    You do not. Html forms don't query databases, and they don't have
    Perl-like variables to put the results in. I can more or less figure out
    what you are trying to say, but you should still learn how to say it (and
    think about it) properly. If you did, you would find it easier to figure
    out on your own.


    > The query results are then displayed on a "results page"
    > that contains common features like sorting by column, change the number
    > of records displayed per page, etc...


    Is the paging thing really necessary? I find that if I have 10,000 things
    to show someone, the chances of them looking at all of them are pretty much
    the same whether I show them 100 pages of 100 things or 1 page with 10,000
    things.

    > Currently, when the user clicks
    > on one of these features on the results page, the query parameters are
    > passed via url and the script is run again providing the requested
    > changes.


    Not Perl related, but you may want to check out aprilsoft, which lets the
    user do paging and sorting right in the browser.


    > My question is this: Is it possible, when the user first
    > submits the query form, to create an array reference (my $results_ref =
    > \@results; my @new_results = @$results_ref;) and then use this
    > reference when the results page features are clicked.


    I think that something vaguely like what you are trying to describe is
    possible. See CGI::Session, for example.

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
     
    , Sep 6, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ce
    Replies:
    1
    Views:
    3,020
  2. JKop
    Replies:
    12
    Views:
    725
    Howard
    Jul 21, 2004
  3. Mara Guida

    const and array of array (of array ...)

    Mara Guida, Sep 2, 2009, in forum: C Programming
    Replies:
    3
    Views:
    521
    David RF
    Sep 3, 2009
  4. fatted
    Replies:
    2
    Views:
    163
    James Willmore
    Oct 23, 2003
  5. Andrew Poulos

    Using an array to reference a different array

    Andrew Poulos, Dec 22, 2008, in forum: Javascript
    Replies:
    6
    Views:
    100
    Jorge
    Dec 23, 2008
Loading...

Share This Page