problem with array and GoogChart
<p>ok.. I know I can find help here :)</p>

<p>I am barely out of noobhood so be gentle :)</p>

<p>I'm trying to fetch data from a db and use it to call a pie chart in GoogChart so here is my problem... some code like db connections etc. is skipped to get to the point.</p>

<p>First we look at the array GoogChart uses to pass the info:</p>

<pre><code> $data = array(
    '8' =&gt; 6,
    '3' =&gt; 3,
    '9' =&gt; 2,
    );
</code></pre>

<p>Now we look at how I am trying to do it pulling the data from a db:</p>

<pre><code>//connect and query here
while ($row=mysql_fetch_array($query)){
$viewid=trim($row['id']);

$total_views=trim($row['views']);

// trimmed cuz I can't sort it out

$dat = "'$viewid' =&gt; $total_views,"; //problem likely here
} 



$data = array(
$dat
);
</code></pre>

<p>When I echo the $dat, I get this:</p>

<pre><code>'8' =&gt; 6,'3' =&gt; 3,'9' =&gt; 2,
</code></pre>

<p>So theoretically, it should work??? But noop :(</p>

<p>There may be a totally different way of doing this but I'm stumped... didn't take much to do it either lol.</p>
