components - set manually id for row of table by JTable in joomla -


i have table field user_id (unique). want set manually set it.but when set it,jtable not insert data. $data array is:

$data['user_id']=500; $data['name']='test'; $data['lastname']='test'; 

and code in model is:

$table = $this->gettable();         if ($table->save($data) === true) { return $table->user_id;} 

and table file is:

   class userprotableuser extends jtable     {      public function __construct(&$db)     {         parent::__construct('#__userpro_users', 'user_id', $db);     } } 

try this:

$table->bind($data); $table->save(); 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -