I was wondering if you could create variable variables for objects, please
see examples below, Im having problems getting it to work.
    
    $data['fieldname'] = foo;
 
    // without variable variables
    $res =& $db->query( "SELECT foo FROM table" );
 
    while( $res->fetchInto( $db_data ) )
    {
        echo $db_data->foo; // pretend this echos bar
    }
 
 
     // with variable variables
    $varVar = '$db_data->'.$data['fieldname']; // should be $db_data->foo
 
    $res =& $db->query( "SELECT foo FROM table" );
 
       while( $res->fetchInto( $db_data ) )
    {
        echo ${$varVar}; // would like this to echo bar
    }
 
 
Thanks, Mark

Reply via email to