Jump to content

Some Help needed converting old modules


HostworX

Recommended Posts

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

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated