幻令 发表于 2018-8-11 16:01:25

更新和条件-php快速入门系列教程

更新和条件主讲人: 幻令博客:https://blog.icodef.com论坛:https://www.eruyi.cn目录:https://www.eruyi.cn/thread-1412-1-1.html
updateupdate开头,set后为设置的数据,不同的列使用','分开
举个栗子

update `table` set `field1`='value',`field2`='value2' where `id`=1;
wherewhere后面接的是条件,如果是update的话,后面接的意思就是修改那些行的内容,还有delete(删除),select(查询)的时候也会用到where语句
常用操作符
常用的有下面这些=(相等),<>/!=(不等于),>(大于),<(小于),>=(大于等于),<=(小于等于)
like模糊查询的时候会用到like
where `field` like '%模糊';/** 百分号在前表示搜索结尾为'模糊'的行 **//** 在后则表示搜索开头为'模糊'的行,两边都打上就是内容包括'模糊'的行 **/
in/not in值是否是in中的其中一个,not in 相反
where `id` in (1,2,3);where `id` not in (1,2,3);
多条件多个条件就使用 and(且),or(或) 来连接,和我们写php中的&& || 一样
where `field`='value' and `field2`='value2';where `field`='value' or (`field2`='value2' and `id` in (1,2,3));

**** Hidden Message *****

影思 发表于 2022-12-11 10:41:43

谢谢分享

pnf 发表于 2020-11-5 21:39:26

66666666666

小恒哥 发表于 2020-9-13 03:05:50

更新和条件-php快速入门系列教程

lbsws123 发表于 2020-6-17 20:19:41

www.eruyi.cn

c3266393 发表于 2019-11-4 10:14:55

很好很强大

17837177264 发表于 2019-11-3 15:17:12

rrrrrrrrrrrrrrrrrrrrrrrr

xiaozhao 发表于 2019-4-5 03:29:52

6666666666666666666666666666666

zhaquanli 发表于 2018-11-3 08:19:18

详细信息学习学习嘻嘻嘻

小学生 发表于 2018-10-14 00:28:25

66666666666666666666666666666
页: [1] 2
查看完整版本: 更新和条件-php快速入门系列教程