search

Home  >  Q&A  >  body text

TP cannot obtain the primary key of the data table when inserting records through the model object

TIM图片20190627134635.png

TIM图片20190627134701.png

之间之间1980 days ago1507

reply all(3)I'll reply

  • 赵子云

    赵子云2019-06-29 17:19:42

    It’s a problem with the database design. There is no default value for id. Just set the id to increase by itself.

    reply
    0
  • 黄埔竹下

    黄埔竹下2019-06-28 14:02:12

    Try this: Db::name('user')->insertGetId($data);

    reply
    1
  • 殘留の回憶

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

    Look carefully, save is a modification statement, not an insertion

    reply
    0
  • Cancelreply