douka19950505 2015-09-25 21:01
浏览 39

PHP / Mysql:搜索序列化数据的字符串[重复]

This question already has an answer here:

I have started work on a project that someone else created, this is what he has done:
In a mySql table he has a TEXT field called "allData", in that field he has serialized records that look like this


(There's a lot more data but I cut it down by around 95% so it would not mess up this page)

Any idea how I can search the above data for senderEmail or HASH?

  • 写回答

2条回答 默认 最新

  • douzhong1730 2015-09-25 21:13
    SELECT * FROM table WHERE allData LIKE '%""%' AND allData LIKE '%"ebdeb85d094cefd102b630fa9e69d9ca"%' LIMIT 1;;

    This example should allow you to search for a specific HASH and senderEmail in the table and return that entry if a match of both fields exist in the serialized data. This would be useful to put into a view so that it can be retrieved quickly and easily, and you of course can see where you would want to change the email and hash in the query. In this example it will return that exact entry.

    More information:

    MySQL Like Function

    Search inside serialize data with MYSQL

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥20 Html备忘录页面制作
  • ¥15 黄永刚的晶体塑性子程序中输入的材料参数里的晶体取向参数是什么形式的?
  • ¥20 数学建模来解决我这个问题
  • ¥15 计算机网络ip分片偏移量计算头部是-20还是-40呀
  • ¥15 stc15f2k60s2单片机关于流水灯,时钟,定时器,矩阵键盘等方面的综合问题
  • ¥15 YOLOv8已有一个初步的检测模型,想利用这个模型对新的图片进行自动标注,生成labellmg可以识别的数据,再手动修改。如何操作?
  • ¥30 NIRfast软件使用指导
  • ¥20 matlab仿真问题,求功率谱密度
  • ¥15 求micropython modbus-RTU 从机的代码或库?
  • ¥15 django5安装失败