You need to convert the generated string to an array
$carr = mysqli_query($db, "SELECT id,t,b,ty,msg,log FROM `comm` ORDER BY id DESC"); $comm = 'array( '; while ($row = mysqli_fetch_array($carr)) { $comm .= "array('id'=>$row[id], 't'=>$t, 'text'=>'$row[msg]'), "; } $comm .= ")"; print_r($comm);
At the exit:
array( array('id'=>4, 't'=>NULL, 'text'=>'11111111111111111111'), array('id'=>3, 't'=>NULL, 'text'=>'1111111111111'), array('id'=>2, 't'=>NULL, 'text'=>'Тестик'), )
Accordingly, it is defined as a string. how to be?