Manol Posted May 23, 2018 Share Posted May 23, 2018 I've this piece of code $p = wire('pages')->get(1024); echo $p->resp; // OK $p->resp = "33"; // not working $p->of(false); $p->save(); I can read the output of $p->resp, but when I try to save a new value $p->resp="33" is not working, any ideas. Thanks. Link to comment Share on other sites More sharing options...
elabx Posted May 23, 2018 Share Posted May 23, 2018 Try to turn off output formatting before changing the value. 5 Link to comment Share on other sites More sharing options...
Manol Posted May 23, 2018 Author Share Posted May 23, 2018 $p->of(false); Link to comment Share on other sites More sharing options...
Autofahrn Posted May 23, 2018 Share Posted May 23, 2018 $p->of(false); // should go first $p->resp = "33"; // expected to work $p->save(); 3 Link to comment Share on other sites More sharing options...
Manol Posted May 23, 2018 Author Share Posted May 23, 2018 done thanks! Link to comment Share on other sites More sharing options...
bernhard Posted May 23, 2018 Share Posted May 23, 2018 setAndSave does all that for you in one go: https://processwire.com/api/ref/page/set-and-save/ wire('pages')->get(1024)->setAndSave('resp', 33); 7 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now