gpt4 book ai didi

类似mysql的查询

转载 作者:太空宇宙 更新时间:2023-11-03 11:16:48 24 4
gpt4 key购买 nike

如何将 LIKE 查询与 bind_param 结合使用?我试过了:

%?% 

但我做错了,找不到任何引用。

最佳答案

select * from your_table where your_column like concat('%', ?, '%');

并将 ? 绑定(bind)到您的输入值

天真的方法:

select * from your_table where your_column like ?;
$your_input='%'.$your_input.'%';

易受 SQL 注入(inject)攻击,不应使用。

关于类似mysql的查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4529218/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com