Manol Posted May 23, 2018 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.
elabx Posted May 23, 2018 Posted May 23, 2018 Try to turn off output formatting before changing the value. 5
Autofahrn Posted May 23, 2018 Posted May 23, 2018 $p->of(false); // should go first $p->resp = "33"; // expected to work $p->save(); 3
bernhard Posted May 23, 2018 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
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