comma at the end of myData array causing error July 18, 2011 07:54PM |
Registered: 12 years ago Posts: 1 |
I have created a list of possible chart items that are extracting values from the wordpress database. When I create the jscharts code to display the various items within the chart, all goes well until the last conditional. Because the myVar Array ends in a comma the chart does not render. I have tried different types of trimming the last character from the array that I found on google, but none seem to work.
Here is a clip of the conditional code I am using for the myData variable:
Any help is appreciated, Thanks.
Here is a clip of the conditional code I am using for the myData variable:
var myData = new Array( <?php if ($percent_apple != 0) {echo "['Apple'," .$percent_apple."]," ;} ?> <?php if ($percent_grape != 0) {echo "['Grape'," .$percent_grape."]," ;} ?> <?php if ($percent_orange != 0) {echo "['Orange'," .$percent_orange."]," ;} ?> );
Any help is appreciated, Thanks.
Sorry, you do not have permission to post/reply in this forum.