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

  • SEARCH
  • Home
  • 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 193319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:30:01+00:00 2026-05-11T16:30:01+00:00

I need an elegant way to store dynamic arrays (basically spreadsheets without all the

  • 0

I need an elegant way to store dynamic arrays (basically spreadsheets without all the functionality) of various sizes (both x and y), mostly being used as ENUMs, lists, lookup data, price sheets, that sort of thing. Multi-lingual would be a great bonus. Speed of the essence.

Here’s an example of a typical “sheet” ;

            |  1 |  2 |   3 |   4
  -------------------------------
  model A   | 2$ | 5$ |  8$ | 10$
  model B   | 3$ | 6$ |  9$ | 12$
  model C   | 4$ | 8$ | 10$ | 13$

So, to get info, I would do ;

  $price = this_thing_im_after ( '3', 'model B' ) ;
  echo $price ;   // Prints '9$'

I’m in the PHP5 and Zend Framework world, but thoughts on design and SQL is just as dandy, even suggestions on and from the outside world, libs, extensions, etc. as I don’t want to reinvent too much of the wheel. I need the backend stuff the most, and I’ll write a GUI for dynamic sheets later. Thoughts, ideas, pointers?

Just an edit to point out that I’d prefer not to serialize and blob the data as I would like to query the indeces and sheets, perhaps even the data (or type for those who support such, now that would be awsome!) if I’m in a crazy mood. But again, this is not a breaker for me; if someone has a nice library or class for serializing in and out quickly out of a database with some simple querying, I’m all happy.

  • 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-11T16:30:02+00:00Added an answer on May 11, 2026 at 4:30 pm

    Other than serializing the whole thing into a blob field, you probably end up with a key/value table where your key is the row and col fields:

      CREATE TABLE sheet (
          sheet_id int not null,
          name varchar(32),
          rows int, -- stores max dimension if needed
          cols int, -- stores max dimension if needed
          primary key (sheet_id)
      );
      CREATE TABLE cells (
          cell_id identity, -- auto inc field for ease of updates
          sheet_id int not null, -- foreign key to sheet table
          row int not null,
          col int not null,
          value smalltext, -- or a big varchar depending on need
          primary key (cell_id), -- for updates
          unique index (sheet_id, row, col), -- for lookup
          index (value) -- for search
      );
    
      CREATE TABLE row_labels (
          sheet_id int not null,
          row int not null,
          label varchar(32),
          primary key (sheet_id, row)
      );
    
      CREATE TABLE col_labels (
          sheet_id int not null,
          col int not null,
          label varchar(32),
          primary key (sheet_id, col)
      );
    

    This allows you to slice the data nicely:

     // Slice [4:20][3:5]
     SELECT row, col, value FROM cells
     WHERE sheet_id = :sheet
       AND row BETWEEN 4 AND 20
       AND col BETWEEN 3 AND 5
     ORDER BY row, col
    
     while ($A = fetch()) {
         $cell[$A['row'][$A['col']] = $A['value']; // or unserialize($A['value']);
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.