2

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

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

and my code in model is:

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

and my table file is:

   class UserproTableuser extends JTable
    {

    public function __construct(&$db)
    {
        parent::__construct('#__userpro_users', 'user_id', $db);
    }
}
MJH
  • 31
  • 2

1 Answers1

0

Try this:

$table->bind($data);
$table->save();
Tom Mwenda
  • 155
  • 3
  • 16