I have this PHP code:
foreach( $wpdb->get_results( ) as $key => $row) { echo \"[\'\". $row->DATE . \"\',\". $row->total_sales . \"],\"; }
put your string in substr() function
$string = ""; while ($row = mysql_fetch_array($result)) { $string .= $name . ', '; } echo substr($string, 0, strlen($string) - 2);