Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4270416
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:18:13+00:00 2026-05-21T07:18:13+00:00

I have an application that generates an array of statistics based on a greyhounds

  • 0

I have an application that generates an array of statistics based on a greyhounds racing history. This array is then used to generate a table which is then output to the browser. I am currently working on creating a function that will generate an excel download based on these statistics. However, this excel download will only be available after the original processing has been completed. Let me explain.

  1. The user clicks on a race name
  2. The data for that race is then processed and displayed in a table.
  3. Underneath the table is a link for an excel download.

However, this is where I get stuck. The excel download exists within another method within the same controller like so…

function view($race_id) {
    //Process race data and place in $stats
    //Output table & excel link
}

function view_excel($race_id) {
    //Process race data <- I don't want it to have to process all over again!
    //Output excel sheet
}

As you can see, the data has already been processed in the “view” method so it seems like a massive waste of resources having it processed again in the “view_excel” method.

Therefore, I need a method of transferring $stats over to the excel method when the link is clicked to prevent it having to be reproduced. The only methods I can think of are as follows.

  • Transferring $stats over to the excel method using a session flash
    • The variable may end up being too big for a session variable. Also, if for some reason the excel method is refreshed, the variable will be lost.
  • Transferring $stats over to the excel method using an ordinary session variable
    • As above, the variable may end up being too big for a session variable. This has the benefit that it wont be lost on a page refresh but I’m not sure how I would go about destroying old session variables, especially if the user it processing alot of races in a short period of time.
  • Storing $stats in a database and retrieving it in the excel method
    • This seems like the most viable method. However, it seems like a lot of effort to just transfer one variable across. Also, I would have to implement some sort of cron job to remove old database entries.

An example of $stats:

Array
(
    [1] => Array
        (
            [fcalc7] => 
            [avgcalc7] => 
            [avgcalc3] => 86.15
            [sumpos7] => 
            [sumpos3] => 9
            [sumfin7] => 
            [sumfin3] => 8
            [total_wins] => 0
            [percent_wins] => 0
            [total_processed] => 4
            [total_races] => 5
        )

    [2] => Array
        (
            [fcalc7] => 28.58
            [avgcalc7] => 16.41
            [avgcalc3] => 28.70
            [sumpos7] => 18
            [sumpos3] => 5
            [sumfin7] => 23
            [sumfin3] => 7
            [total_wins] => 0
            [percent_wins] => 0
            [total_processed] => 7
            [total_races] => 46
        )

    [3] => Array
        (
            [fcalc7] => 28.47
            [avgcalc7] => 16.42
            [avgcalc3] => 28.78
            [sumpos7] => 28
            [sumpos3] => 11
            [sumfin7] => 21
            [sumfin3] => 10
            [total_wins] => 0
            [percent_wins] => 0
            [total_processed] => 7
            [total_races] => 63
        )
)

Would be great to hear your ideas.

Dan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T07:18:13+00:00Added an answer on May 21, 2026 at 7:18 am

    You could serialize the array into a file in sys_get_temp_dir() with a data-dependet file name. The only problem left is cleaning up old files.

    Putting it into the database is also possible as you said, and deleting old data is easier than on the file system if you track the creation time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my LAMP application (using CodeIgniter), I have a call to $this->db->update... that generates
We have an application that generates simulated data for one of our services for
Background: we have an application that generates reports from HTML (that may or may
I'm using C# and i have written a locally installed application that dynamically generates
I have an application that uses window.open() to generate dynamic popups. Unfortunately, I've had
I have a flex application that needs the ability to generate and execute JavaScript.
I have a c++ plus method that generates a value. i am calling this
I have a function that generates a CRC check byte based on the content
All, I have a PHP application that seems to generate the following headers in
My application is simple, I have 2 pages: RSSProducer.aspx: A page that generates RSS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.