I want to make some charts with dxcharts. Now i have the following situation:
My SQL query is:
$sql = "SELECT
av.art_title,
SUM(CASE c.cont_status WHEN 'cold' THEN av.art_views ELSE 0 END) cold,
SUM(CASE c.cont_status WHEN 'lead' THEN av.art_views ELSE 0 END) lead,
SUM(CASE c.cont_status WHEN 'prospect' THEN av.art_views ELSE 0 END) prospect,
SUM(CASE c.cont_status WHEN 'lost' THEN av.art_views ELSE 0 END) lost
FROM article_views av
JOIN contacts c ON av.user_id = c.id
GROUP BY av.art_title";
$res = mysql_query($sql) or die (mysql_error());
I have a while loop on the query like:
while($row = mysql_fetch_assoc($res)) { }
And below i will post my javascript var:
var dataSource = [{ country: "<?php echo $row['art_title']; ?>", lead: <?php echo $row['lead']; ?>, lost: <?php echo $row['lost']; ?>}, ];
So if i use the while in the datasource var it's not working at all. Can anyone help me out here?
json_encode()so you're generating syntactically correct JS strings.art_titel? instead ofart_title