10-03-2018, 09:52 AM
I haven't seen your members table, but I'm guessing when you look at the column names, the id and user id are two different columns. Right? The update query expects that you're updating by id.
So in other words if I have a row id of 12 but my user_id column is 20, the update query would be looking to update the row 12. So you need to specify the column name that you're attaching it to. I'll assume it's userid just for demo purposes.
it would be
$db->update('member',['userid','=',$userId],$fields);
So in yours $db->update('member',$userId,$fields), that middle $userid gets changed into an array of [columname,operator,data]
One other note, if you have a query that you're having issues with, you can do...
dnd($db->errorInfo()); or dump($db->errorInfo()); and you'll usually get error messages that tell you what's wrong.
So in other words if I have a row id of 12 but my user_id column is 20, the update query would be looking to update the row 12. So you need to specify the column name that you're attaching it to. I'll assume it's userid just for demo purposes.
it would be
$db->update('member',['userid','=',$userId],$fields);
So in yours $db->update('member',$userId,$fields), that middle $userid gets changed into an array of [columname,operator,data]
One other note, if you have a query that you're having issues with, you can do...
dnd($db->errorInfo()); or dump($db->errorInfo()); and you'll usually get error messages that tell you what's wrong.