当前位置:网站首页>PHP MySQL Update
PHP MySQL Update
2022-07-03 17:51:00 【Crooning ~ shallow singing】
Update the data in the database
UPDATE Statement is used to update the existing records in the database table .
grammar
UPDATE table_name SET column1=value, column2=value2,... WHERE some_column=some_value
notes : Please note that UPDATE The grammatical WHERE Clause .WHERE Clause specifies which records need to be updated . If you want to omit WHERE Clause , All records will be updated !
To learn more about SQL Knowledge , Please visit our SQL course .
In order to make PHP Execute the above statement , We have to use mysqli_query() function . This function is used to send a message to MySQL Connect to send queries or commands .
example
In previous chapters of this tutorial , We created a "Persons" Table of , As shown below :
FirstName | LastName | Age |
---|---|---|
Peter | Griffin | 35 |
Glenn | Quagmire | 33 |
The following example updates "Persons" Some data of the table :
example
<?php
$con=mysqli_connect("localhost","username","password","database");
// Detection connection
if (mysqli_connect_errno())
{
echo " The connection fails : " . mysqli_connect_error();
}
mysqli_query($con,"UPDATE Persons SET Age=36
WHERE FirstName='Peter' AND LastName='Griffin'");
mysqli_close($con);
?>
After this update ,"Persons" The table is shown below :
FirstName | LastName | Age |
---|---|---|
Peter | Griffin | 36 |
Glenn | Quagmire | 33 |
边栏推荐
- 国内如何购买Google Colab会员
- How to read the source code [debug and observe the source code]
- [combinatorics] recursive equation (summary of the solution process of recursive equation | homogeneous | double root | non-homogeneous | characteristic root is 1 | exponential form | the bottom is th
- Kotlin的協程:上下文
- Deops入门
- Internet Hospital his Management Platform source, online Inquiry, appointment Registration Smart Hospital Small program source
- Website with JS doesn't work in IE9 until the Developer Tools is activated
- Loop through JSON object list
- How to purchase Google colab members in China
- AcWing 4489. 最长子序列
猜你喜欢
Research Report on market demand and investment planning for the development of China's office chair industry, 2022-2028
Micro service component sentinel console call
1147_ Makefile learning_ Target files and dependent files in makefile
How to deploy applications on kubernetes cluster
Notes on problems -- watching videos on edge will make the screen green
Leetcode 538 converts binary search tree into cumulative tree -- recursive method and iterative method
Analysis report on production and marketing demand and investment forecast of China's PVC industry from 2021 to 2026
Leetcode Valentine's Day Special - looking for a single dog
聊聊支付流程的设计与实现逻辑
QT adjust win screen brightness and sound size
随机推荐
PS screen printing brush 131, many illustrators have followed suit
Hongmeng third training
Enterprise custom form engine solution (XI) -- form rule engine 1
Y is always discrete and can't understand, how to solve it? Answer: read it several times
OpenSSL的SSL/BIO_get_fd
Is AI too slow to design pictures and draw illustrations? 3 sets of practical brushes to save you
PR second time
Cloud primordial weekly | CNCF released the 2021 cloud primordial development status report, which was released on istio 1.13
List of financial products in 2022
What is the difference between cloud server and cloud virtual machine
数学公式(测试)
Classroom attendance system based on face recognition tkinter+openpyxl+face_ recognition
Micro service component sentinel console call
Design limitations of structure type (struct)
Fedora 21 installs lamp host server
Research Report on competitive strategy Outlook Analysis and investment strategic planning of China's smart home equipment industry, 2022-2028
[combinatorics] recursive equation (solution of linear non-homogeneous recursive equation with constant coefficients | standard form and general solution of recursive equation | proof of general solut
解决Zabbix用snmp监控网络流量不准的问题
互联网医院HIS管理平台源码,在线问诊,预约挂号 智慧医院小程序源码
小程序 多tab 多swiper + 每个tab分页