I have a list of data as json which I have decoded in php. I am trying to loop through the array to dynamically display its contents in a url which will display a google chart diagram in PHP. The contents of the data are saved in a php variable $value and $label with concatenation to join the string.
so my url looks somthing like this.
$url = 'https://chart.googleapis.com/chart?cht=p3&chd=t:' **. $value .** '&chs=375x150&chl=' **. $label .** '&chco=4D89F9,009900,FF9900,FF7F7F,FFD088,8FA3D6';
$url = urlencode(**$url**);
Everything looks fine except the image can not be rendered in the php file due to a trailing (,) colon sign.
Here is the full url after being encoded. In bold are the contents of $value
https://chart.googleapis.com/chart?cht=p3&chd=**t:0.3,1.4,65.3,1.0,4.3,0.5,**&chs=375x150&chl=CBD%7CCBN%7CTHC%7CCBC%7CCBG%7CTHCV%7C&chco=4D89F9,009900,FF9900,FF7F7F,FFD088,8FA3D6
You can see after the last value of 0.5 there is a trailing (,) comma sign and I dont know how to get rid of it. When I remove this last comma the image renders itself on the page.
Any help will be greatly appreciated.
Thanks
$value, so you need to fix whatever's generating the string in$value.$value.