从 PHP 代码查询 MySQL?
您可以在 mysql 查询中使用它们的代码吗?
我使用此代码从收件人处查找了一些电子邮件。
mysql_query("select * from Friends where Reciver like '%$term%'");
但我想做一个像
mysql_query("select * from Friends where Reciver or Sender like '%$term%'");
我的问题一样的代码?这是正确的吗,因为当我尝试它时,它没有产生任何结果?
如果不对,你能这么说并说明为什么不对吗?我从错误中吸取了教训?
Is their a code were you can use Or in a mysql query?
I used this code to find some Emails from a reciver.
mysql_query("select * from Friends where Reciver like '%$term%'");
but i want to do a code like
mysql_query("select * from Friends where Reciver or Sender like '%$term%'");
my question is? is this right because when I try it it doesn't come up with anything?
If it isn't right could you say so and say why it isn't? i learn well from my mistakes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
首先。查看 SQL 注入的危险。
第二次尝试此查询。
1st of all. Check out the dangers of SQL Injection.
2nd try this query.
这是你如何做的
Here is how you do it
您可以执行此查询,并且您的查询应如下所示:
You can do this query and for that your query should be like this: