billsinc

Members
  • Content count

    7
  • Joined

  • Last visited

Everything posted by billsinc

  1. I've gone through all the documentation I could find and have spent a lot of time on the forums. My other post http://www.fusioncharts.com/forum/Topic12041-31-1.aspx didn't get a final response so I thought I would be more generic. I need a PHP code example of a multi-series chart that uses arrays from MySQL. Does anyone have such a thing? Thanks!
  2. I'm using the example code to try to create a multidimensional array from a MySQL table. I'm still very new to PHP so I know I'm not constructing or parsing the array properly. Here's my code: <?php include("Includes/FusionCharts.php"); include("Includes/DBConn.php"); $IP_Addr = $_SERVER["REMOTE_ADDR"]; ?> <?php // Connect to the DB $link = connectToDB(); //$strXML will be used to store the entire XML document generated //Generate the chart element $strXML = ""; //Initialize element - necessary to generate a multi-series chart $strCategories = ""; //Initiate elements $strDataGross = ""; $strDataOwn = ""; // Fetch properties by ip $strQuery1 = "SELECT element_2 FROM ap_form_1 WHERE ip_address ='$IP_Addr' GROUP BY ip_address, element_1, element_2"; $result[1] = mysql_query($strQuery1) or die(mysql_error()); // Fetch all gross revenue records by ip $strQuery2 = "SELECT SUM(element_7) FROM ap_form_1 WHERE ip_address ='$IP_Addr' GROUP BY ip_address, element_1, element_2"; $result[2] = mysql_query($strQuery2) or die(mysql_error()); // Fetch all owner revenue records by ip $strQuery3 = "SELECT SUM(element_9) as TotOwnGrossVal FROM ap_form_1 WHERE ip_address ='$IP_Addr' GROUP BY ip_address, element_1, element_2"; $result[3] = mysql_query($strQuery3) or die(mysql_error()); //Iterate through the data foreach ($result as $resultSub) { //Append to strCategories $strCategories .= ""; //Add to both the datasets $strDataGross .= ""; $strDataOwn .= ""; } //Close element $strCategories .= ""; //Close elements $strDataGross .= ""; $strDataOwn .= ""; //Assemble the entire XML now $strXML .= $strCategories . $strDataGross . $strDataOwn . ""; //Create the chart with data from $strXML echo renderChart("charts/Column3D.swf", "", $strXML, "PropertyValue", "100%", 400, false, false); mysql_close($link); ?>
  3. The code won't display so I've attached it. xml.txt
  4. Thank you, that helped and I think I'm almost there. I've got the two categories to display properly, but I can't populate the second one. I know my syntax is wrong for the IF statment, but this is what I have: $result = mysql_query($strQuery) or die(mysql_error()); // Add Categories $FC->addCategory("Property Gross Value"); $FC->addCategory("Owner Share"); if ($result) { $FC->addDatasetsFromDatabase($result, "PurDate", "TotGrossVal"); $FC->addDatasetsFromDatabase($result, "PurDate", "TotOwnShare"); }
  5. Thanks for your help. I think I'm a little over my head with this. This is what I have and it still doesn't work. I noticed the code tags don't work so I've uploaded by code as an attachment. chart_code.txt