well I’m post data json to my backend and I have this error:
{
"message": "Record not found in table \"users\" with primary key ['6']",
"url": "/users/userdata",
"code": 404
}
I don’t know why? I have a user with id = 6 in my database, in my function I recieve the data and id correctly, check this part, my controller:
public function userdata()
{
$user = TableRegistry::get(‘Users’);
$id = $this->request->getData(‘iduser’);
$data = $user->get($id, [
//'contain' => ['Cities']
]);
$this->set([
'success' => true,
'data' => $data,
'_serialize' => ['success', 'data']
]);
}
Try this with $this->Users->get($id) and $this->Users->find($id) I always get the same error