saghar

Members
  • Content count

    2
  • Joined

  • Last visited

About saghar

  • Rank
    Forum Newbie
  1. Invalid Data Error, String Method

    Yes, my query returns correct results. Anything else that I need to check?
  2. I have a form that posts values to a php file which includes a FC graph. When I do not choose any option in the form page, the chart is drawn properly. But when I choose "month" and submit the form, I get the "invalid data" error. I checked everything and seems that data is passed correctly between pages. Here is my code, can you help me on this please? <?php //We have included ../Includes/FusionCharts.php, which contains functions //to help us easily embed the charts. include("../Includes/FusionCharts.php"); ?> <html> <head> <?php //You need to include the following JS file, if you intend to embed the chart using JavaScript. //When you make your own charts, make sure that the path to this JS file is correct. Else, you //will get JavaScript errors. ?> <script language="Javascript" src="../FusionCharts/FusionCharts.js"></script> <title>FusionCharts XT - Simple Column 3D Chart using dataStr method</title> </head> <body> <?php $strMonth = $_POST['month']; if ($strMonth=="0") { $strMonth="1=1"; } else { $strMonth = "month = '".$strMonth."'"; } $server = "myserver:3306"; $username = "myusername"; $password = "mypassword"; $db_name = "mydb"; $db = mysql_connect($server,$username,$password) or DIE("Connection to database failed, perhaps the service is down!!"); mysql_select_db($db_name,$db) or DIE("Database name not available !!"); $strXML = ""; $strXML .= "<chart paletteColors='b0e0e6, 00008b, ffe4c4, d2b4be, 9885d3, 42f1d2, 258998, f4a460, dc143c, d3d3d3, 20b2aa' caption='Cost by Category/Brand' xAxisName='Category' yAxisName='Cost (Million)' showLabels='1' showvalues='1' decimals='2' numberPrefix='$' clustered='0' exeTime='1.5' showPlotBorder='0' zGapPlot='30' zDepth='90' divLineEffect='emboss' startAngX='10' endAngX='18' startAngY='-10' endAngY='-40' showAboutMenuItem='More insightfull data'>"; $sql="SELECT category, cost FROM mytable WHERE ".$strMonth." GROUP BY category ORDER BY cost DESC"; $result=mysql_query($sql); while($row = mysql_fetch_row($result)){ $strXML .= "<set label='$row[0]' value='$row[1]'/>"; } $strXML .= "</chart>"; echo renderChart("../FusionCharts/Column3D.swf", "", $strXML, "myNext", 600, 300, false, true); ?> </body> </html>