I have this text string varchar type i get from database echo. how to extract it and count the value :
in the database it save as string ["1","2","3"] in varchar. how to count this as 3 item using php?
my sql code is :
$sql2 = "SELECT * FROM il_dcl_stloc1_value WHERE record_field_id = '$exc_prt_id'";
$result2 = $conn->query($sql2);
while($row2 = $result2->fetch_assoc()) {
$exc_prt_id1 = $row2['value'];
echo "$exc_prt_id1"; // this will result ["1","2","3"]
}
json_decodeit to an array and just callcount.(VAR)CHAR|TEXT2) Which MySQL version? As MySQL has native JSON parsing functionsSELECT VERSION();3) Whats the reason of storing in JSON this simple array can really easy be normalized?