HostworX Posted March 7, 2018 Share Posted March 7, 2018 Hi, Possibly someone can tell me what the hell I am doing wrong here basically I have a database table with all my settings for my module, ie each row has 3 coloums ID, setkey, setval. I need to create variables from these values that my module can use to connect etc Using capsule I call the following $settings = Capsule::table('mod_debitorder_settings') ->select('setkey', 'setval') ->get(); foreach ($settings as $data) { $$data->setkey=$data->setval; } The array if I do a print_r($settings); is Array ( [0] => stdClass Object ( [setkey] => NTC_USERNAME [setval] => someone ) [1] => stdClass Object ( [setkey] => NTC_PASSWORD [setval] => 1234 ) But the $$data-setkey=$data->setval; in the module does not do this for some reason, If I use a plainold php file calling the db and do this without using a class it works fine. Link to comment Share on other sites More sharing options...
Recommended Posts