'Search data from mysqli column having json data in php
I have to filter row where information is column having json data
[{"id":"27653","color":"red"},{"id":"56854","color":"blue"}]
I am trying this query but getting nothing
$sql = "SELECT information FROM products WHERE JSON_EXTRACT(information,'$.color') = 'red' ";
$query = mysqli_query($conn,$sql);
while ($row = mysqli_fetch_array($query)) {
print_r($row["information"]);
}
How can i get the result {"id":"27653","color":"red"}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
