我在 mysql 列 ( extraData
) 中存储了一些额外的表单数据作为 json。
示例数据
{"1":{"name":"sadsdaf ","surname":"sdafa","occupation":"sdaas","email":"dsasdaf@asdf.nl","barcode":"052355491"},"2":{"name":"sadafd","surname":"sdafa","occupation":"sddaf","email":"sda@daf.nl","barcode":"052355492"}}
我想做一个搜索查询,它还搜索存储在 json 编码字段中的条形码?所以不仅如此
$sql = "SELECT name FROM visitors WHERE barcode = '".$barcode."'";
但是也
$sql = "SELECT name FROM visitors WHERE barcode = '".$barcode."' OR extraData = '".$barcode."'";
我需要做什么才能extraData
检查可变条形码并获得相应的姓名、姓氏等?