当前位置:网站首页>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 |
边栏推荐
- Inheritance of ES6 class
- 分布式的任务分发框架-Gearman
- [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
- Life perception 1
- VM11289 WAService. js:2 Do not have __ e handler in component:
- How to install PHP on Ubuntu 20.04
- Research Report on investment trends and development planning of China's thermal insulation material industry, 2022-2028
- As soon as we enter "remote", we will never regret, and several people will be happy and several people will be sad| Community essay solicitation
- 1164 Good in C
- Play with fancy special effects. This AE super kit is for you
猜你喜欢
一入“远程”终不悔,几人欢喜几人愁。| 社区征文
Draw some simple graphics with MFC
Leetcode 538 converts binary search tree into cumulative tree -- recursive method and iterative method
Hongmeng third training
STM32 realizes 74HC595 control
TCP congestion control details | 3 design space
Ml (machine learning) softmax function to realize the classification of simple movie categories
vs2013已阻止安装程序,需安装IE10
Leetcode Valentine's Day Special - looking for a single dog
Discussion sur la logique de conception et de mise en oeuvre du processus de paiement
随机推荐
Leetcode 669 pruning binary search tree -- recursive method and iterative method
OpenSSL的SSL/BIO_get_fd
Records of long objects and long judgments in the stream of list
[combinatorics] recursive equation (four cases where the non-homogeneous part of a linear non-homogeneous recursive equation with constant coefficients is the general solution of the combination of po
SSL / bio pour OpenSSL Get FD
POM in idea XML graying solution
Research Report on investment trends and development planning of China's thermal insulation material industry, 2022-2028
1164 Good in C
基于人脸识别的课堂考勤系统 tkinter+openpyxl+face_recognition
Postfix 技巧和故障排除命令
Cloud primordial weekly | CNCF released the 2021 cloud primordial development status report, which was released on istio 1.13
Applet with multiple tabs and Swipers + paging of each tab
c# . Net tool ecosystem
Life perception 1
Internet Hospital his Management Platform source, online Inquiry, appointment Registration Smart Hospital Small program source
Interviewer: why is the value nil not equal to nil?
Brief introduction to the core functions of automatic penetration testing tool
PS screen printing brush 131, many illustrators have followed suit
[教程]在 CoreOS 上构建你的第一个应用
Where is the database account used when running SQL tasks in data warehouse tasks configured