I have a structure like such:
{"placards":
[
{"barcode": "string", "destination":"string", "weight":"string"},
{etc...}
]
}
stored on a single column in a MYSQL database.
I am trying to search for a specific barcode, and return the entire row where that barcode is inside that json structure in that row.
I have tried two methods, both found on stack overflow but I am not getting a result in one method, and below I will post the error from the latter.
attempt1:
"SELECT * FROM table WHERE placards[*->barcode] = ".$job->events[0]->imcb;
attempt2:
$sampleBC = $job->events[0]->imcb;
$sql = 'SELECT * FROM(
SELECT data_column->"[*]" as row
from table
where $sampleBC IN JSON_EXTRACT(data_column, ""
)
WHERE row->".barcode" = $sampleBC';
neither of these methods gives an error on $stmt->error, but I am not actually able to successfully grab anything with this query.