加入收藏 | 设为首页 | 会员中心 | 我要投稿 财气旺网 - 财气网 (https://www.caiqiwang.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

Mysql where子句(搜索表列匹配)[重复]

发布时间:2022-12-13 14:36:28 所属栏目:MySql教程 来源:互联网
导读: This question already has an answer here:
I have 1 table, t1,around 500+ data rowMySQL where 子句, I just show a sample data.
Data as below:
+--------+----------+-------------

This question already has an answer here:

I have 1 table, t1,around 500+ data rowMySQL where 子句, I just show a sample data.

Data as below:

+--------+----------+-------------------+
| id     | Name     | category          |
+--------+----------+-------------------+
| 1      | ABC      | 6,9,25,27         |

select 查询子句 mysql_where子句不等于_MySQL where 子句

+---------------------------------------+

My mysql query like below:

$gcategory = intval($_GET['cat']);
$test = DB::fetch_all("SELECT * FROM t1 WHERE category like '%$gcategory%' ORDER BY id DESC");
foreach($test as $te){

where子句不等于_MySQL where 子句_select 查询子句 mysql

$list[] = $te; }

But if $gcategory = '7'; the ABC also will appear in my $list[], but I just want when $gcategory = '6' || $gcategory = '9' || $gcategory = '25' || $gcategory = '27' then ABC only appear in my $list[]? how to fix this?

Thanks.


(编辑:财气旺网 - 财气网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!