当前位置:网站首页>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 |
边栏推荐
- 毕业总结
- TensorBoard快速入门(Pytorch使用TensorBoard)
- c# .net 工具生态
- Y is always discrete and can't understand, how to solve it? Answer: read it several times
- Market demand survey and marketing strategy analysis report of global and Chinese pet milk substitutes 2022-2028
- Gear2021 monthly update - December
- Kotlin's collaboration: Context
- Internet Hospital his Management Platform source, online Inquiry, appointment Registration Smart Hospital Small program source
- List的stream中Long对象与long判等问题记录
- Kotlin的協程:上下文
猜你喜欢
Interviewer: why is the value nil not equal to nil?
微服务组件Sentinel控制台调用
MySQL grouping query
Market demand survey and marketing strategy analysis report of global and Chinese pet milk substitutes 2022-2028
问题随记 —— 在 edge 上看视频会绿屏
Talk about the design and implementation logic of payment process
Internet Hospital his Management Platform source, online Inquiry, appointment Registration Smart Hospital Small program source
QT adjust win screen brightness and sound size
Applet setting multi account debugging
聊聊支付流程的设计与实现逻辑
随机推荐
Tensorboard quick start (pytoch uses tensorboard)
Postfix tips and troubleshooting commands
Kotlin的协程:上下文
Global and Chinese pediatric palliative care drug market development research and investment planning recommendations report 2022-2028
Remote office tools sharing | community essay solicitation
TCP congestion control details | 3 design space
远程办公工具分享|社区征文
AcWing 271. 杨老师的照相排列【多维DP】
What is the difference between cloud server and cloud virtual machine
i++与++i的区别:通俗易懂的讲述他们的区别
How to enforce parameters in PowerShell- How do I make parameters mandatory in PowerShell?
Introduction to SolidWorks gear design software tool geartrax
[Yu Yue education] family education SPOC class 2 reference materials of Shanghai Normal University
POM in idea XML graying solution
[combinatorics] generating function (linear property | product property)
微服务组件Sentinel控制台调用
Classroom attendance system based on face recognition tkinter+openpyxl+face_ recognition
Fedora 21 installs lamp host server
[教程]在 CoreOS 上构建你的第一个应用
Play with fancy special effects. This AE super kit is for you