Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Editing $db = array() values via Controller


Go to End


3 Posts   1318 Views

Avatar
MarioSommereder

Community Member, 107 Posts

4 October 2013 at 4:34pm

Hi,

I execute a function from the controller and want to update a variable stored at $db = array(), but I don't get it...

Here is a pastie with my code: http://pastie.org/8376525

Thanks.

Avatar
Willr

Forum Moderator, 5523 Posts

4 October 2013 at 7:52pm

Looks like you're there. You should be able to call the URL of your page such as mysite.com/mypage/makeUpdate and it should run. Do you get an error? That makeUpdate function should probably return something, either redirect the user to another page or show them some sort of error message.

Avatar
MarioSommereder

Community Member, 107 Posts

4 October 2013 at 7:56pm

This is so wired.

When I access the variable in the controller, it contains the correct values, but it seems, that they are not written to the database.

Means, when I try to read em back in - either via the controller or the CMS backend - they don't contain the changes.

Sorry, no error message, even nothing inside the Apache logs.