Building a table of constants
Posted: Wed Sep 10, 2003 10:23 am
All of my pages refer to a 20x100 table of "constant" data, with each page using a few rows or columns. I am looking for the most efficient way to store this table.
I've come up with a couple obvious ways, but they both have drawbacks. I'm hoping someone more experienced could point to a better way.
Method 1: Create an include file, where I build the table using arrays.
+Only one line of code required to get full access to the table.
-Must build the 2000-cell table every time a page loads.
Method 2: Store the table in an SQL database.
+Only loads the needed rows or columns, reducing execution time.
-Must create custom SQL lookup code for every page.
Is there really a big speed difference between these two solutions? Is there a better solution?
-David McWilliams
I've come up with a couple obvious ways, but they both have drawbacks. I'm hoping someone more experienced could point to a better way.
Method 1: Create an include file, where I build the table using arrays.
+Only one line of code required to get full access to the table.
-Must build the 2000-cell table every time a page loads.
Method 2: Store the table in an SQL database.
+Only loads the needed rows or columns, reducing execution time.
-Must create custom SQL lookup code for every page.
Is there really a big speed difference between these two solutions? Is there a better solution?
-David McWilliams