当前位置:网站首页>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 |
边栏推荐
- Five problems of database operation in commodity supermarket system
- 鸿蒙第四次培训
- Notes on problems -- watching videos on edge will make the screen green
- Ssl/bio of OpenSSL_ get_ fd
- Is AI too slow to design pictures and draw illustrations? 3 sets of practical brushes to save you
- Hongmeng third training
- 聊聊支付流程的设计与实现逻辑
- Tensorboard quick start (pytoch uses tensorboard)
- Leetcode Valentine's Day Special - looking for a single dog
- 远程办公工具分享|社区征文
猜你喜欢
[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
微服务组件Sentinel控制台调用
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
Five problems of database operation in commodity supermarket system
STM32 realizes 74HC595 control
鸿蒙第四次培训
How to read the source code [debug and observe the source code]
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
Analysis report on production and marketing demand and investment forecast of China's PVC industry from 2021 to 2026
随机推荐
QT学习日记9——对话框
PR second time
Automata and automatic line of non-standard design
1146_ SiCp learning notes_ exponentiation
VM11289 WAService. js:2 Do not have __ e handler in component:
Cloud primordial weekly | CNCF released the 2021 cloud primordial development status report, which was released on istio 1.13
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
Inheritance of ES6 class
基于人脸识别的课堂考勤系统 tkinter+openpyxl+face_recognition
Golang unit test, mock test and benchmark test
STM32实现74HC595控制
Codeforces Round #803 (Div. 2) C. 3SUM Closure
[Yu Yue education] family education SPOC class 2 reference materials of Shanghai Normal University
Vs2013 has blocked the installer, and ie10 needs to be installed
OpenSSL的SSL/BIO_get_fd
OpenSSL的SSL/BIO_get_fd
Introduction to SolidWorks gear design software tool geartrax
Kotlin的協程:上下文
Type conversion, variable
[LINUX]CentOS 7 安装MYSQL时报错“No package mysql-server available“No package zabbix-server-mysql availabl