当前位置:网站首页>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 |
边栏推荐
- How to install PHP on Ubuntu 20.04
- STM32H7 HAL库SPI DMA发送一直处于busy的解决办法
- [LINUX]CentOS 7 安装MYSQL时报错“No package mysql-server available“No package zabbix-server-mysql availabl
- Golang unit test, mock test and benchmark test
- Market demand survey and marketing strategy analysis report of global and Chinese pet milk substitutes 2022-2028
- Automata and automatic line of non-standard design
- First day of rhcsa study
- Records of long objects and long judgments in the stream of list
- WEB-UI自动化测试-最全元素定位方法
- Getting started with deops
猜你喜欢

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

Notes on problems -- watching videos on edge will make the screen green

STM32实现74HC595控制

QT学习日记9——对话框

1146_ SiCp learning notes_ exponentiation

Talk about the design and implementation logic of payment process

1164 Good in C

问题随记 —— 在 edge 上看视频会绿屏

Vs2013 has blocked the installer, and ie10 needs to be installed

聊聊支付流程的設計與實現邏輯
随机推荐
Mathematical formula (test)
Wechat applet for the first time
微服务组件Sentinel控制台调用
Supervisor monitors gearman tasks
How to enforce parameters in PowerShell- How do I make parameters mandatory in PowerShell?
[教程]在 CoreOS 上构建你的第一个应用
Gear2021 monthly update - December
Postfix 技巧和故障排除命令
Research Report on investment trends and development planning of China's thermal insulation material industry, 2022-2028
Deops入门
互联网医院HIS管理平台源码,在线问诊,预约挂号 智慧医院小程序源码
Where is the database account used when running SQL tasks in data warehouse tasks configured
Discussion sur la logique de conception et de mise en oeuvre du processus de paiement
Basic grammar of interview (Part 2)
国内如何购买Google Colab会员
Global and Chinese health care OEM and ODM market status survey and investment planning recommendations report 2022-2028
How to deploy applications on kubernetes cluster
First day of rhcsa study
Leetcode 108 converts an ordered array into a binary search tree -- recursive method
[combinatorics] generating function (linear property | product property)