0
In mysql database I have the following table:
Note that the column field is in json format. I have several records in a single field. I need a script to count each record separated by comma and add and assign it to a variable. In this case the variable would be set to 6.
In the code below I get the amount of records per line, but I’m not able to make the sum.
$conexao = mysqli_connect('localhost','root','');
$banco = mysqli_select_db($conexao,'movement');
mysqli_set_charset($conexao,'utf8');
$res = mysqli_query($conexao,"SELECT coluna FROM tabela");
while($r = mysqli_fetch_assoc($res)) {
echo count(json_decode($r['coluna'], true));
}