search

Home  >  Q&A  >  body text

thinkphp5 has a sql statement that will be modified if it exists or created if it does not exist.

If you use native functions, you have to make repeated judgments every time before taking the route that doesn't work. I wonder if thinkphp5 has any convenient and quick statements.

I also checked the manual and didn’t see any relevant content. Could you please give me some guidance

为情所困为情所困2751 days ago1052

reply all(3)I'll reply

  • 滿天的星座

    滿天的星座2017-06-21 10:13:31

    Execute original mysql statement

    db("table")->execute("replace into table(id, name) values(9, 2)");

    reply
    0
  • 三叔

    三叔2017-06-21 10:13:31

    I personally think that no matter what framework and language, you must first determine whether it exists, and then operate based on the judgment results. The framework only makes it easier for you to judge whether it exists, but you still have to make a judgment in the end.

    reply
    0
  • ringa_lee

    ringa_lee2017-06-21 10:13:31

    No, you can write one yourself

    reply
    0
  • Cancelreply