search
HomePHP FrameworkThinkPHPHigh energy ahead, some students are stumped by the update of the TP model

This article will talk about the update method of the model in the TP framework.

Preface

##❝Kaka has compiled a roadmap and created an interview guide, preparing to follow this roadmap I am writing an article, and I will add some knowledge points that have not been added later. I also hope that all my partners can help add them. See you in the comment area!

High energy ahead, some students are stumped by the update of the TP model
##Insert picture description here

Let’s take a look at the usage given in the document first!

The previous usage of Kaka was like this. High energy ahead, some students are stumped by the update of the TP model

  • Introduce the model
  • Instantiate the model
  • Then use the query method of the database in the document

High energy ahead, some students are stumped by the update of the TP modelThis classmate made a mistake using this method, so Kaka directly used the static calling method to demonstrate to everyone. As follows

High energy ahead, some students are stumped by the update of the TP modelAt first glance, there is nothing wrong with this usage, and it is exactly the same as what the documentation says. The result is unsatisfactory, let's take a look at the error message.

This is very heartless, it is exactly the same as the document, why is there a lack of update conditions! High energy ahead, some students are stumped by the update of the TP modelBu_id in this set of data is the primary key ID, that’s right!

There is no problem if you use it according to the documentation! Are you confused at this time? High energy ahead, some students are stumped by the update of the TP modelAt this time, my classmates found me, so of course Kaka had to help solve it! Who makes me enthusiastic!

In fact, this problem cannot be said to be a problem, because it is not caused by a bug in the code, nor is there a problem with my own writing.

Follow Kaka’s footsteps to trace this issue. First open the document, navigate directly to the model chapter, and then look at the definition of the model.

There is a sentence like this. The default primary key of the model is id. If the primary key of the database design is not id, you need to set a pk attribute yourself.

High energy ahead, some students are stumped by the update of the TP modelAfter reading the above sentence, I think everyone understands that although the primary key in our table exists in our data. But this primary key is not the default model primary key id, so an error will occur.

Then it’s very simple! Just define the primary key of the data table in the model!

High energy ahead, some students are stumped by the update of the TP modelSure enough, the problem was solved.

Persistence in learning, persistence in blogging, and persistence in sharing are the beliefs that Kaka has always upheld since his career. I hope that Kaka’s articles in the huge Internet can bring you a little Silk help. See you next time.

The above is the detailed content of High energy ahead, some students are stumped by the update of the TP model. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
修复:谷歌浏览器更新检查失败错误代码3:0x80040154修复:谷歌浏览器更新检查失败错误代码3:0x80040154Apr 13, 2023 pm 05:46 PM

谷歌浏览器是全球最受欢迎的浏览器之一,许多用户更喜欢将其用作 Windows PC 上的默认浏览器。Chrome 提供了广泛的功能,使浏览体验愉快而轻松,因此,它仍然是最受信任的浏览器之一。但是,就像任何其他浏览器一样,即使 Chrome 也有其自身的缺点,它同样容易在您最需要的时候出现错误和故障。一个这样的错误是错误代码 3:0x80040154,这发生在检查 Google Chrome 更新时。错误消息显示为“检查更新时发生错误。更新检查无法启动(错误代码 3:0x80080005)或(错误

一起聊聊thinkphp6使用think-queue实现普通队列和延迟队列一起聊聊thinkphp6使用think-queue实现普通队列和延迟队列Apr 20, 2022 pm 01:07 PM

本篇文章给大家带来了关于thinkphp的相关知识,其中主要介绍了关于使用think-queue来实现普通队列和延迟队列的相关内容,think-queue是thinkphp官方提供的一个消息队列服务,下面一起来看一下,希望对大家有帮助。

如何启用/禁用 VS Code 自动更新如何启用/禁用 VS Code 自动更新Apr 28, 2023 am 09:28 AM

如果您正在使用VisualStudioCode(VSCode)并考虑如何禁用它的自动软件更新以及如何禁用其扩展的自动更新,那么请阅读本文。如果你不经常使用VSCode,隔了很长一段时间打开编辑器并想启用自动更新,本文也将指导你这样做。让我们详细讨论启用或禁用VSCode自动更新的不同方法。目录方法一:使用设置启用/禁用VSCode自动更新第一步:打开VS代码,在左下角点击齿轮状的符号。第2步:在出现的列表中单击设置。第3步:在搜索栏中输入更新并回车。查找更新:模式第4

Microsoft compatibility telemetry占用高CPU的解决方法Microsoft compatibility telemetry占用高CPU的解决方法Mar 16, 2024 pm 10:16 PM

我们在使用win10系统的时候有时候会遇到电脑变得卡顿的情况,然后我们在查看后台进程的时候会发现一个Microsoftcompatibilitytelemetry的进程占用资源特别的高,那么这是怎么回事?用户们可以尝试卸载三方防护软件后尝试干净启动来进行操作,下面就让本站来为用户们来仔细的介绍一下Microsoftcompatibilitytelemetry占用高CPU的解决方法吧。Microsoftcompatibilitytelemetry占用高CPU的解决方法方法一:卸载三方防护软件后尝试

KDE Plasma 6.1 brings many enhancements to the popular Linux desktopKDE Plasma 6.1 brings many enhancements to the popular Linux desktopJun 23, 2024 am 07:54 AM

After several pre-releases, the KDE Plasma development team unveiled version 6.0 of its desktop environment for Linux and BSD systems on 28 February, using the Qt6 framework for the first time. KDE Plasma 6.1 now comes with a number of new features t

thinkphp3.2怎么关闭调试模式thinkphp3.2怎么关闭调试模式Apr 25, 2022 am 10:13 AM

在thinkphp3.2中,可以利用define关闭调试模式,该标签用于变量和常量的定义,将入口文件中定义调试模式设为FALSE即可,语法为“define('APP_DEBUG', false);”;开启调试模式将参数值设置为true即可。

SQL中UPDATE语句怎么用SQL中UPDATE语句怎么用Jun 02, 2023 pm 09:13 PM

SQLUPDATE语句Update语句用于修改表中的数据。语法如下:UPDATE表名称SET列名称=新值WHERE列名称=某值"Person"表:LastNameFirstNameAddressCityGatesBillXuanwumen10BeijingWilsonChamps-Elysees更新某一行中的一个列UPDATEPersonSETFirstName="Fred"WHERELastName="Wilson"结果:LastNa

Fitbit Ace LTE receives major update with new games, contactless payment and other featuresFitbit Ace LTE receives major update with new games, contactless payment and other featuresAug 08, 2024 pm 09:39 PM

The Fitbit Ace LTE was officially launched in May, but is currently only available in the US. The smartwatch is aimed specifically at children, who can receive rewards for games through a more active lifestyle, while parents can always monitor their

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download

Atom editor mac version download

The most popular open source editor