This is another way to load variables quickly within $this, and allows for intervention on variable names.
All columns from the single-row result are loaded and accessed via $this->_variableName.
<?
class MyClass{
public function _load($nID) {
$Q = "SELECT * FROM myTable";
if($aTmp = RETURN_Q_ARRAY($Q)) {
$aTmp = $aTmp[0];
$aK =array_keys($aTmp);
foreach($aK as $sK) {
if(!is_numeric($sK)) $this->{"_$sK"}=$aTmp[$sK];
}
return true;
}
return false;
}
}
$o = new MyClass;
$o->_load(1);
echo $o->_id; //1
echo $o->_otherColumn; //otherColumn value