当前位置:网站首页>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 |
边栏推荐
- WEB-UI自动化测试-最全元素定位方法
- 自动渗透测试工具核心功能简述
- link preload prefetch
- POM in idea XML graying solution
- ArrayList分析3 : 删除元素
- 分布式的任务分发框架-Gearman
- Applet setting multi account debugging
- [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
- Leetcode 108 converts an ordered array into a binary search tree -- recursive method
- 面试官:值为 nil 为什么不等于 nil ?
猜你喜欢

Select 3 fcpx plug-ins. Come and see if you like them

微服务组件Sentinel控制台调用

Golang单元测试、Mock测试以及基准测试

Leetcode 538 converts binary search tree into cumulative tree -- recursive method and iterative method

聊聊支付流程的設計與實現邏輯
![[combinatorics] generating function (summation property)](/img/74/e6ef8ee69ed07d62df9f213c015f2c.jpg)
[combinatorics] generating function (summation property)

Applet setting multi account debugging

鸿蒙第四次培训

Research on Swift

Talk about the design and implementation logic of payment process
随机推荐
ArrayList分析3 : 删除元素
PHP returns 500 errors but no error log - PHP return 500 error but no error log
毕业总结
Y is always discrete and can't understand, how to solve it? Answer: read it several times
Leetcode Valentine's Day Special - looking for a single dog
Design limitations of structure type (struct)
解决Zabbix用snmp监控网络流量不准的问题
一入“远程”终不悔,几人欢喜几人愁。| 社区征文
Investigation on the operation prospect of the global and Chinese Anti enkephalinase market and analysis report on the investment strategy of the 14th five year plan 2022-2028
Hongmeng third training
supervisor监控Gearman任务
PR second time
问题随记 —— 在 edge 上看视频会绿屏
Leetcode 108 converts an ordered array into a binary search tree -- recursive method
AcWing 271. 杨老师的照相排列【多维DP】
Classroom attendance system based on face recognition tkinter+openpyxl+face_ recognition
Fedora 21 安装 LAMP 主机服务器
QT adjust win screen brightness and sound size
The difference between i++ and ++i: tell their differences easily
[combinatorics] generating function (linear property | product property)