doutuobao4004 2018-02-05 02:07
浏览 47

如何使用PHP和SQL在一个文本框中搜索特定项?

I have 2 tables, TABLE1 for parts and TABLE2 for vehicle application.

TABLE1

part_no | description | brand | price             
1234_AB | OIL SEAL | BRANDx | 97.50              
5678_CD | AIRCON FILTER | BRANDy | 400.00

TABLE2

part_no | make_name | name | year_model     
1234_AB | HONDA | LEGEND | 1991             
5678_CD | HONDA | PRELUDE | 1982       
1234_AB | HONDA | CIVIC | 1978          
5678_CD | HONDA | ACCORD | 1979     

then I want to search this in 1 textbox:
OIL FILTER HONDA CIVIC 1978
or CIVIC HONDA 1978 OIL FILTER
or 1978 HONDA CIVIC OIL FILTER

then it will show this result:

part_no | description | brand | price     
1234_AB | OIL SEAL | BRANDx | 97.50
  • 写回答

1条回答 默认 最新

  • dongxietao0263 2018-02-05 02:25
    关注

    Take the input from the textbox, split this with the " " (space) character and push to an array.

    You should have created table entities so just loop through a comparison of each string value in the array to the entity properties.

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题