2016-10-24 09:10
浏览 120


My Query SELECT * from users where user_id='$keyword' OR username='$keyword' OR email='$keyword' OR skype='$keyword' OR balance='$keyword' OR spent='$keyword' OR status='$keyword' OR created='$keyword' OR last_auth='$keyword'


Returning random rows

图片转代码服务由CSDN问答提供 功能建议

My Query SELECT * from users 其中user_id ='$ keyword' OR username = '$ keyword' OR email ='$ keyword' OR skype ='$ keyword' OR balance ='$ keyword' OR spent ='$ keyword' OR status ='$ keyword'\ n OR created ='$ keyword' OR last_auth ='$ keyword'


返回随机行 < / DIV>

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doukun0888 2016-10-24 09:16

    Use LIKE instead of trying to get the exact value.

    SELECT * from  users where user_id LIKE '%$keyword' OR username LIKE '%$keyword%' OR email LIKE '%$keyword%' OR skype LIKE '%$keyword%' OR balance LIKE '%$keyword%' OR spent LIKE '%$keyword%' OR status LIKE '%$keyword%' OR created LIKE '%$keyword%' OR last_auth LIKE '%$keyword%'

    If you are using LIKE on a number field use:

    CAST(user_id AS CHAR) LIKE '%keyword%'
    解决 无用
    打赏 举报

相关推荐 更多相似问题