The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to update a field in a custom table
#2
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.
  Reply


Messages In This Thread
RE: Unable to update a field in a custom table - by mudmin - 10-03-2018, 09:52 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)