search

Home  >  Q&A  >  body text

The primary key cannot be obtained automatically, and the id must be added manually.

$user = new User();
$data = [
'name'=>'Lu Bu',
'password'=>'888'
];
//Execute the add operation
$result = $user->save($data);

Field 'id' doesn't have a default value


之间之间2036 days ago1312

reply all(4)I'll reply

  • WJ

    WJ2020-05-27 17:20:43

    This is the way to add it

    reply
    0
  • 之间

    yes

    之间 · 2020-05-27 17:22:38
    之间

    This was 300 days ago, when I just learned TP, haha

    之间 · 2020-05-27 17:23:13
  • 殘留の回憶

    殘留の回憶2019-06-27 22:22:13

    Don’t you have to write a where condition to update the data? It definitely won’t work like this

    reply
    0
  • Cancelreply