In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to solve the problem of thinkphp save failure". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to solve the problem of thinkphp save failure".
The solution to thinkphp save failure: 1, open the corresponding code file; 2, use "$this- > typeModel- > field ('id,name,sort')-> data ($data)-> save ();" to update the data.
This article operating environment: Windows7 system, thinkphp v5.1, Dell G3 computer.
How to solve the problem of thinkphp save failure?
Failed to update thinkphp save ()
I. failure cases
$data = I (); $rs = $this- > typeModel- > data ($data)-> save ()
II. Correct cases
Correct one: rs=$this- > typeModel- > field ('id,name,sort')-> data ($data)-> save (); correct 2: / / $rs=$this- > typeModel- > where (' id='.$data ['id'])-> field (' name,sort')-> data ($data)-> save (); correct 3: / / $rs=M ('CityCategory')-> where (' id='.$data ['id'])-> field (' name,sort')-> data ($data)-> save (); / Note: / / 1. If the new data is the same as the original data, it will be the same as the new failure / / 2. No field restriction will result in modification failure / / 3. You need to write the primary key id and the field to be changed in field, or write the primary key id in the where condition.
Third, cause analysis
All the fields id pid name path sort in the value $data received from the foreground have values, but some of the new data is the same as the old data.
When the new data and the old data have the same field data, you need to use field to determine the data that needs to be changed. It is estimated that it will be updated even if it is the same in field.
Thank you for your reading, the above is the content of "how to solve the problem of thinkphp save failure", after the study of this article, I believe you have a deeper understanding of how to solve the problem of thinkphp save failure, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.