Closed just-wkj closed 7 years ago
There is no problem for the code you shown. Perhaps you have to tell more detail about what kind of sometimes is. It should not be the problem.
Secondly, what's the version of Medoo? The latest version had changed last_query()
to last()
.
When inserting data, it is sometimes necessary to add the quotation marks to the array to perform the success eg: $openid ,"$openid" $openid = 'myopenid'; $db->insert("mytable", array("openid" => "$openid")); $db->last_query(): INSERT INTO "mytable" ("openid") VALUES ("myopenid") $db->insert("mytable", array("openid" => $openid)); $db->last_query(): INSERT INTO "mytable" ("openid") VALUES () !!!! empty!!! // 使用insert方法的插入数据的时候,有时会存在 拼接好的sql语句缺少value,必须加上引号才能执行成功,