I have this code to extract sum of column records in mysql
<?php
$query = "select sum(sell) from store where sell!=0";
$result = $crud->getData($query);
$total_s = implode(" ",$result);
settype($total_s, "integer");?>
<p>Sum now is: <?php var_dump($result);//here my output in html?></p>
<?php //now i want to show in percent from max how much is sell
$maxm = 1000000;
$percent = $total_s / $maxm;
$percent_x = number_format( $percent * 100, 2 );
echo floor($percent_x) . '%';?>
Output in html:
array(1) { [0]=> array(1) { ["sum(sell)"]=> string(5) "25165" } }
In error_log i have the message:
Array to string conversion in /home/dancr/public_html/app/out.php on line 36