I'm trying to print the values from an array as a string. I got this code from the PHP documents, but I'm getting a string conversion error. The values are numbers and I can see them
$viz_array_qry = "SELECT (`column_name`) FROM table_name WHERE option_name='$option_name'";
$result = mysql_query($viz_array_qry);
$result_array = array();
while($row = mysql_fetch_assoc($result))
{
$result_array[] = $row;
$viz_array = implode (',',$result_array);
}
print_r($viz_array);
//echo $viz_array; <!-- no result-->
If I var_dump the $result_array I get the list of the values below. But I just want to display them as
0,0,57,39,40
I cant work out why the implode it not working?
array (size=5)
0 =>
array (size=1)
'column_name' => string '0' (length=1)
1 =>
array (size=1)
'column_name' => string '0' (length=1)
2 =>
array (size=1)
'column_name' => string '57' (length=2)
3 =>
array (size=1)
'column_name' => string '39' (length=2)
4 =>
array (size=1)
'column_name' => string '40' (length=2)