Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
User metadata is not updating
I am trying ot update user metadata with this:
$user = \Model\Auth_User::find($id);
$user->someprofilefield = 'somevalue';
but I get the next error:
ERROR - 2016-02-11 19:25:26 --> Exception thrown: (some_controller.php#123): SQLSTATE: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key, value, user_id, created_at, updated_at) VALUES ('44', 'someprofilefield', 'somevalue' at line 1 with query: "INSERT INTO USER_METADATA (parent_id, key, value, user_id, created_at, updated_at) VALUES ('44', 'someprofilefield', 'somevalue', 44, 1455236726, 0)"
So, I see that field names not quoted and field `key` caused a syntax error. And two questions:
1. Why are the fields not quoted?
2. Why in another application the same code is working well? May this error depends on Mysql version?
Oh, I've fixed it for now. It was a broken version of core from 1.8/dev branch. Thank you.
Add a Comment
It looks like you're new here. If you want to get involved, click one of these buttons!
Apply for Membership
↳ Job Board
↳ Installation & Setup
↳ Tips and Tutorials
↳ Code share
In this Discussion