douwei2966 2015-08-02 23:05
浏览 591

REGEXP具有多个字段和条件

Instead of searching through a single column for query, I would like my Regexp query to refer to several columns in determining the results of a search as well as limit the the extend of its search activity per session the search function is executed ( so for instance, on the first session the search will only look for the first 10, while if the search is prompted a second time then the next 10 will be sought for). The reason for this limited extend is to prevent latency issues in the long run if the database grows.

I am wanting to do this for a camp roster, where non-fixed keywords will determine the group members of registered campers based on searching through two columns: hobbies and spirit_animal_explanation for words matching the keywords.

PHP:

$searchCD = "SELECT * FROM users WHERE hobbies AND spirit_animal_explanation REGEXP '".$keywords."' LIMIT 10";
$searchST = $con->query($searchCD);

if ($searchST) {
while ($row = $searchST->fetch_assoc()) {

  echo $row["first_name"]. "<br/>" . "<br/>" . $row["hobbies"] . "<br/>" . $row["spirit_animal_explanation"] .
  "<br/>" . $row["avatar"] . "<br/><br/>"  ;

}

}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 gdf格式的脑电数据如何处理matlab
    • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
    • ¥100 监控抖音用户作品更新可以微信公众号提醒
    • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
    • ¥70 2048小游戏毕设项目
    • ¥20 mysql架构,按照姓名分表
    • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
    • ¥15 Macbookpro 连接热点正常上网,连接不了Wi-Fi。
    • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
    • ¥15 linux驱动,linux应用,多线程