-2
In the databank I have a column that takes strings in this format: ["87","12","67"]
What I need is to count each value separated by comma and assign to some variable, remembering that there are more lines. In this case I would have a variable with the value 3.
My code hasn’t evolved much, but I believe this is the way:
$conexao = mysqli_connect('localhost','root','');
$banco = mysqli_select_db($conexao,'bd');
mysqli_set_charset($conexao,'utf8');
$res = mysqli_query($conexao,"SELECT replace(replace(coluna,'[',''),']','') FROM tabela");
$var = array($res);
echo count($var);
I count on the help of the community.
+1, very simple and direct
– Bacco