duanjian3920 2015-02-06 11:33
浏览 12

使用PHP和MySQL保存搜索

I need to save user searches in the database so that the user could see the results against those searches anytime he wants and also he can get email notifications if any new record matches their search criteria.In short, i want something like the saved search thing in http://www.immobilienscout24.de/

Here in http://www.immobilienscout24.de/ i can search properties giving different search params and can save that search.Then i have a "Saved searches" option that lists down all the saved searches with "show" option.Clicking on the "show" option displays the results against that saved search.

I thought of two solutions which are as follows:-

  1. Take all the search params and make a query using them.Store that query in database.I am preferring this solution till now as it only requires fetching and executing the query when one wants to see the results against a specific search.The only disadvantage i think in this is the chances of sql injection but it can somehow be managed as i will be making query myself and will check for sql injections
  2. Store the search param as a json object.When viewing the results against the saved search,this will require to first fetch that json object,decode it and making a query out of it and executing it.

I want to know if there are some better solutions to save the user searches in database.Also what are the disadvantages of the above mentioned solutions.What problems i might be facing using one of the above solutions?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 GDI处理通道视频时总是带有白色锯齿
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)
    • ¥15 自适应 AR 模型 参数估计Matlab程序
    • ¥100 角动量包络面如何用MATLAB绘制
    • ¥15 merge函数占用内存过大
    • ¥15 Revit2020下载问题
    • ¥15 使用EMD去噪处理RML2016数据集时候的原理
    • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
    • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数