Hi,

I'm thinking of a class. One that mirrors a database table, and retrieves column values only when requested. Although you can tell it which columns to retrieve initially on construct. Check this pseudo-code:

Code:
class MyTable
  function getColumn1
	if not set $_column1 then $_column1= sqlretrieve('column1')
	return $_column1
 
  function setColumn1($value)
	$_column1 = $value
	sqlsave(Column1, $value)
 
  constructor(optional columns)
	refreshSQL(columns)
 
  function refreshSQL(columns)
	sqlretrieve(columns[0], columns[1]...)
 
  function updateSQL(optional columns)
	create and execute sql command to retrieve values for either 'columns' or every column that's been set before
 
  function sqlsave(column(s), value(s))
	create and execute sql command to update column values
Then, I'd create a PHP file in a cache directory that creates a 'MyTable' object statically (instead of retrieving all the values from the db again), and I'd use that object...

Would this be advisable? Would it create unnecessary strain on either the db server or PHP?

Your thoughts are appreciated!