当前位置:网站首页>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 |
边栏推荐
- UE4 official charging resources, with a total price of several thousand
- [set theory] order relation: summary (partial order relation | partial order set | comparable | strictly less than | covering | hasto | total order relation | quasi order relation | partial order rela
- 1164 Good in C
- Micro service component sentinel console call
- AcWing 4489. Longest subsequence
- 互联网医院HIS管理平台源码,在线问诊,预约挂号 智慧医院小程序源码
- 互聯網醫院HIS管理平臺源碼,在線問診,預約掛號 智慧醫院小程序源碼
- QT学习日记9——对话框
- WEB-UI自动化测试-最全元素定位方法
- Postfix tips and troubleshooting commands
猜你喜欢

Wechat applet for the first time

Talk about the design and implementation logic of payment process

Qt调节Win屏幕亮度和声音大小

Leetcode 108 converts an ordered array into a binary search tree -- recursive method

AcWing 271. 杨老师的照相排列【多维DP】

TCP congestion control details | 3 design space

聊聊支付流程的设计与实现逻辑

TensorBoard快速入门(Pytorch使用TensorBoard)

Internet hospital his management platform source code, online consultation, appointment registration smart hospital applet source code

Getting started with deops
随机推荐
SSL / bio pour OpenSSL Get FD
[Yu Yue education] family education SPOC class 2 reference materials of Shanghai Normal University
企业级自定义表单引擎解决方案(十一)--表单规则引擎1
c# .net 工具生态
AcWing 4489. 最长子序列
[combinatorics] recursive equation (case where the non-homogeneous part is exponential | example where the non-homogeneous part is exponential)
How to enforce parameters in PowerShell- How do I make parameters mandatory in PowerShell?
Managing multiple selections with MVVM - managing multiple selections with MVVM
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
Golang unit test, mock test and benchmark test
STM32H7 HAL库SPI DMA发送一直处于busy的解决办法
UE4 official charging resources, with a total price of several thousand
[mathematical logic] equivalent calculus and reasoning calculus of predicate logic (individual word | predicate | quantifier | predicate logic formula | two basic formulas | proposition symbolization
1164 Good in C
一入“远程”终不悔,几人欢喜几人愁。| 社区征文
TCP拥塞控制详解 | 3. 设计空间
Implementation of Tetris in C language
1146_ SiCp learning notes_ exponentiation
Ssl/bio of OpenSSL_ get_ fd
link preload prefetch