DELETE statement is used to delete rows from a database table.
Syntax
DELETE FROM table_name
WHERE some_column = some_value
Note: Please pay attention to the WHERE clause in the DELETE syntax. The WHERE clause specifies which records need to be deleted. If you want to omit the WHERE clause, all records will be deleted!
To learn more about SQL, please visit our SQL tutorial.
Example description
Let’s take a look at the data in our Myguests first:
Let’s delete the firstname=’Mary’ data
<?php header("Content-type:text/html;charset=utf-8"); //设置编码 $con=mysqli_connect("localhost","root","root","test"); // 检测连接 if (mysqli_connect_errno()) { echo "连接失败: " . mysqli_connect_error(); } mysqli_query($con,"DELETE FROM Myguests WHERE firstname='Mary'"); mysqli_close($con); ?>
Run the program:
Let’s look at the data in the table again
Has been deleted successfully
【Remember】
1. Be sure to remember to add the where condition when deleting, otherwise the entire table will be cleared record of.
2. Be sure to back up, back up, back up before deleting important data.
睡觉腰疼是什么原因hcv7jop9ns3r.cn | oa是什么意思hcv8jop3ns1r.cn | 15一16岁青少年腰疼是什么病hcv8jop6ns0r.cn | 腮腺炎是什么原因引起的luyiluode.com | 丰的部首是什么偏旁hcv9jop4ns3r.cn |
肝脏低密度灶是什么意思xjhesheng.com | 女装大佬什么意思hcv8jop7ns7r.cn | 雷什么风什么成语sanhestory.com | lof是什么意思hcv7jop5ns5r.cn | 处暑是什么节气hcv8jop4ns4r.cn |
1.13是什么星座hcv9jop0ns4r.cn | 头皮发白是什么原因hcv9jop0ns1r.cn | 脚踝韧带拉伤吃什么hcv9jop3ns7r.cn | 李逵属什么生肖hcv8jop5ns2r.cn | 鸡精和味精有什么区别hcv8jop0ns9r.cn |
西瓜有什么功效和作用hcv9jop2ns0r.cn | ct是什么单位hcv9jop1ns1r.cn | 金牛座前面是什么星座bysq.com | 醋粉是什么做的hcv7jop6ns3r.cn | 叫嚣是什么意思hcv7jop5ns1r.cn |