sruder

Members
  • Content count

    10
  • Joined

  • Last visited

About sruder

  • Rank
    Junior Member
  1. Limit Data Shown

    Thanks for the help everybody! I think that we have it working now!
  2. Limit Data Shown

    Thanks again everybody! Now, I have the start of the a chart - though it only shows one bar when there should be many... any other suggestions? Code here: $FC = new FusionCharts("ScrollColumn2D","1100","450", "0", "0"); # Set Relative Path of swf file. $FC->setSWFPath("http://www.autoublog.com/service_data/FusionCharts_Developer/Charts/"); # Define chart attributes $strParam="caption=Customer Pay Hours Per Ro" . $WeeklyData . " Output;subcaption=HRs Per RO;xAxisName=Week End Date;showValues=0"; # Set chart attributes $FC->setChartParams($strParam); # Add category names $FC->addCategory("Week 1"); # Create a new dataset $FC->addDataset("This Month"); // Fetch all factory records usins SQL Query //Store chart data values in 'total' column/field and category names in 'FactoryName' $strQuery = "select CP_HRs,WeekEndDate from " .$x->QueryFrom . ' ' . $x->QueryWhere . ' ' . " order by WeekEndDate DESC "; $result = mysql_query($strQuery) or die(mysql_error()); //Pass the SQL Query result to the FusionCharts PHP Class function //along with field/column names that are storing chart values and corresponding category names //to set chart data from database if ($result) { $FC->addDataFromDatabase($result, "CP_HRs", "WeekEndDate"); } mysql_close($link); # Render the chart $FC->renderChart();
  3. Limit Data Shown

    Does the Scroll chart require an XML file to work?
  4. Limit Data Shown

    Thanks again for replying. The SWF file is fine that is where they are located. However, I guess the issue is that I am not sure there is an XML generated. This code works for the 'non' scroll SWF file - so thought it work for the scroll one too. Shawn
  5. Limit Data Shown

    Just as another follow up - on the scroll chart, which I think is the way to go! However, when I set it up it says there is "No Data to Display" - guess I am not sure how it is different for the scroll 2d vs. the regular 2d. Here is the code to pull it from the database: $FC = new FusionCharts("ScrollColumn2D","1100","450"); # Set Relative Path of swf file. $FC->setSWFPath("http://www.autoublog.com/service_data/FusionCharts_Developer/Charts/"); # Define chart attributes $strParam="caption=Customer Pay Hours Per Ro" . $WeeklyData . " Output;subcaption=HRs Per RO;xAxisName=Week End Date"; # Set chart attributes $FC->setChartParams($strParam); // Fetch all factory records usins SQL Query //Store chart data values in 'total' column/field and category names in 'FactoryName' $strQuery = "select CP_HRs,WeekEndDate from " .$x->QueryFrom . ' ' . $x->QueryWhere . ' ' . " order by WeekEndDate DESC "; $result = mysql_query($strQuery) or die(mysql_error()); //Pass the SQL Query result to the FusionCharts PHP Class function //along with field/column names that are storing chart values and corresponding category names //to set chart data from database if ($result) { $FC->addDataFromDatabase($result, "CP_HRs", "WeekEndDate"); } mysql_close($link); # Render the chart $FC->renderChart(); Thanks! Shawn
  6. Limit Data Shown

    Thanks very much! Can xAxisMaxValue work for Date formats?
  7. Limit Data Shown

    I am showing weekly numbers for clients and have an odd problem - too much data to show! Any thoughts on how I can show simply the last x number of weeks as opposed to everything we have? Here is the code: # Define chart attributes $strParam="caption=Customer Pay Hours Per Ro" . $WeeklyData . " Output;subcaption=HRs Per RO;xAxisName=Week End Date; formatNumberScale=0;decimals=2;rotateLabels=1;slantLabels=1"; # Set chart attributes $FC->setChartParams($strParam); // Fetch all factory records usins SQL Query //Store chart data values in 'total' column/field and category names in 'FactoryName' $strQuery = "select CP_HRs,WeekEndDate from " .$x->QueryFrom . ' ' . $x->QueryWhere . ' ' . " order by WeekEndDate"; $result = mysql_query($strQuery) or die(mysql_error()); //Pass the SQL Query result to the FusionCharts PHP Class function //along with field/column names that are storing chart values and corresponding category names //to set chart data from database if ($result) { $FC->addDataFromDatabase($result, "CP_HRs", "WeekEndDate"); } mysql_close($link);
  8. Using AppGini to develop an online resource for tracking information, similar to this link. It shows a chart with the data and basically I would like generate a graph below to reflect the data! Does anybody have an easy way to use the Record_ID_Week to build a graph based on any of the other aspects? Pay, Labor, etc... understand the concept in my head just can't seem to get it started yet. Here is the PHP code: <?php // Data functions for table WeeklyData // This script and data application were generated by AppGini 4.46 // Download AppGini for free from http://www.bigprof.com/appgini/download/ function WeeklyData_insert(){ global $Translation; if($_GET['insert_x']){$_POST=$_GET;} // mm: can member insert record? $arrPerm=getTablePermissions('WeeklyData'); if(!$arrPerm[1]){ return 0; } $WeekEndDate = makeSafe($_POST['WeekEndDateYear']) . '-' . makeSafe($_POST['WeekEndDateMonth']) . '-' . makeSafe($_POST['WeekEndDateDay']); $WeekEndDate = parseMySQLDate($WeekEndDate, ''); $CP_RO_Count = makeSafe($_POST["CP_RO_Count"]); $CP_HRs = makeSafe($_POST["CP_HRs"]); $CustomerPay = makeSafe($_POST["CustomerPay"]); $Total_CP_Labor = makeSafe($_POST["Total_CP_Labor"]); $Total_CP_Parts = makeSafe($_POST["Total_CP_Parts"]); $Notes = makeSafe($_POST["Notes"]); if($WeekEndDate== ''){ echo StyleSheet() . "" . $Translation['error:'] . " 'Week End Date': " . $Translation['field not null'] . ' '; echo ''.$Translation['< back'].''; exit; } if($CP_RO_Count== ''){ echo StyleSheet() . "" . $Translation['error:'] . " 'CP RO Count': " . $Translation['field not null'] . ' '; echo ''.$Translation['< back'].''; exit; } if($CP_HRs== ''){ echo StyleSheet() . "" . $Translation['error:'] . " 'CP HRs': " . $Translation['field not null'] . ' '; echo ''.$Translation['< back'].''; exit; } if($CustomerPay== ''){ echo StyleSheet() . "" . $Translation['error:'] . " 'Customer Pay': " . $Translation['field not null'] . ' '; echo ''.$Translation['< back'].''; exit; } if($Total_CP_Labor== ''){ echo StyleSheet() . "" . $Translation['error:'] . " 'Total CP Labor': " . $Translation['field not null'] . ' '; echo ''.$Translation['< back'].''; exit; } if($Total_CP_Parts== ''){ echo StyleSheet() . "" . $Translation['error:'] . " 'Total CP Parts': " . $Translation['field not null'] . ' '; echo ''.$Translation['< back'].''; exit; } sql("insert into `WeeklyData` set " . "`WeekEndDate`=" . (($WeekEndDate != '') ? "'$WeekEndDate'" : "NULL") . ", " . "`CP_RO_Count`=" . (($CP_RO_Count != '') ? "'$CP_RO_Count'" : "NULL") . ", " . "`CP_HRs`=" . (($CP_HRs != '') ? "'$CP_HRs'" : "NULL") . ", " . "`CustomerPay`=" . (($CustomerPay != '') ? "'$CustomerPay'" : "NULL") . ", " . "`Total_CP_Labor`=" . (($Total_CP_Labor != '') ? "'$Total_CP_Labor'" : "NULL") . ", " . "`Total_CP_Parts`=" . (($Total_CP_Parts != '') ? "'$Total_CP_Parts'" : "NULL") . ", " . "`Notes`=" . (($Notes != '') ? "'$Notes'" : "NULL") . ""); // mm: save ownership data $recID=mysql_insert_id(); sql("insert into membership_userrecords set tableName='WeeklyData', pkValue='$recID', memberID='".getLoggedMemberID()."', dateAdded='".time()."', dateUpdated='".time()."', groupID='".getLoggedGroupID()."'"); return (get_magic_quotes_gpc() ? stripslashes($recID) : $recID); } function WeeklyData_delete($selected_id, $AllowDeleteOfParents=false, $SkipChecks=false){ // insure referential integrity ... global $Translation; // mm: can member delete record? $arrPerm=getTablePermissions('WeeklyData'); $ownerGroupID=sqlValue("select groupID from membership_userrecords where tableName='WeeklyData' and pkValue='".makeSafe($selected_id)."'"); $ownerMemberID=sqlValue("select lcase(memberID) from membership_userrecords where tableName='WeeklyData' and pkValue='".makeSafe($selected_id)."'"); if(($arrPerm[4]==1 && $ownerMemberID==getLoggedMemberID()) || ($arrPerm[4]==2 && $ownerGroupID==getLoggedGroupID()) || $arrPerm[4]==3){ // allow delete? // delete allowed, so continue ... }else{ return FALSE; } sql("delete from `WeeklyData` where `Record_ID_Week`='".makeSafe($selected_id)."'"); // mm: delete ownership data sql("delete from membership_userrecords where tableName='WeeklyData' and pkValue='".makeSafe($selected_id)."'"); } function WeeklyData_update($selected_id){ global $Translation; if($_GET['update_x']){$_POST=$_GET;} // mm: can member edit record? $arrPerm=getTablePermissions('WeeklyData'); $ownerGroupID=sqlValue("select groupID from membership_userrecords where tableName='WeeklyData' and pkValue='".makeSafe($selected_id)."'"); $ownerMemberID=sqlValue("select lcase(memberID) from membership_userrecords where tableName='WeeklyData' and pkValue='".makeSafe($selected_id)."'"); if(($arrPerm[3]==1 && $ownerMemberID==getLoggedMemberID()) || ($arrPerm[3]==2 && $ownerGroupID==getLoggedGroupID()) || $arrPerm[3]==3){ // allow update? // update allowed, so continue ... }else{ return; } $WeekEndDate = makeSafe($_POST['WeekEndDateYear']) . '-' . makeSafe($_POST['WeekEndDateMonth']) . '-' . makeSafe($_POST['WeekEndDateDay']); $WeekEndDate = parseMySQLDate($WeekEndDate, ''); if($WeekEndDate== ''){ echo StyleSheet() . "" . $Translation['error:'] . " 'Week End Date': " . $Translation['field not null'] . ' '; echo ''.$Translation['< back'].''; exit; } $CP_RO_Count = makeSafe($_POST["CP_RO_Count"]); if($CP_RO_Count== ''){ echo StyleSheet() . "" . $Translation['error:'] . " 'CP RO Count': " . $Translation['field not null'] . ' '; echo ''.$Translation['< back'].''; exit; } $CP_HRs = makeSafe($_POST["CP_HRs"]); if($CP_HRs== ''){ echo StyleSheet() . "" . $Translation['error:'] . " 'CP HRs': " . $Translation['field not null'] . ' '; echo ''.$Translation['< back'].''; exit; } $CustomerPay = makeSafe($_POST["CustomerPay"]); if($CustomerPay== ''){ echo StyleSheet() . "" . $Translation['error:'] . " 'Customer Pay': " . $Translation['field not null'] . ' '; echo ''.$Translation['< back'].''; exit; } $Total_CP_Labor = makeSafe($_POST["Total_CP_Labor"]); if($Total_CP_Labor== ''){ echo StyleSheet() . "" . $Translation['error:'] . " 'Total CP Labor': " . $Translation['field not null'] . ' '; echo ''.$Translation['< back'].''; exit; } $Total_CP_Parts = makeSafe($_POST["Total_CP_Parts"]); if($Total_CP_Parts== ''){ echo StyleSheet() . "" . $Translation['error:'] . " 'Total CP Parts': " . $Translation['field not null'] . ' '; echo ''.$Translation['< back'].''; exit; } $Notes = makeSafe($_POST["Notes"]); sql("update `WeeklyData` set " . "`WeekEndDate`=" . (($WeekEndDate != '') ? "'$WeekEndDate'" : "NULL") . ", " . "`CP_RO_Count`=" . (($CP_RO_Count != '') ? "'$CP_RO_Count'" : "NULL") . ", " . "`CP_HRs`=" . (($CP_HRs != '') ? "'$CP_HRs'" : "NULL") . ", " . "`CustomerPay`=" . (($CustomerPay != '') ? "'$CustomerPay'" : "NULL") . ", " . "`Total_CP_Labor`=" . (($Total_CP_Labor != '') ? "'$Total_CP_Labor'" : "NULL") . ", " . "`Total_CP_Parts`=" . (($Total_CP_Parts != '') ? "'$Total_CP_Parts'" : "NULL") . ", " . "`Notes`=" . (($Notes != '') ? "'$Notes'" : "NULL") . " where `Record_ID_Week`='".makeSafe($selected_id)."'"); // mm: update ownership data sql("update membership_userrecords set dateUpdated='".time()."' where tableName='WeeklyData' and pkValue='".makeSafe($selected_id)."'"); } function WeeklyData_form($selected_id = "", $AllowUpdate = 1, $AllowInsert = 1, $AllowDelete = 1, $ShowCancel = 0){ // function to return an editable form for a table records // and fill it with data of record whose ID is $selected_id. If $selected_id // is empty, an empty form is shown, with only an 'Add New' // button displayed. global $Translation; // mm: get table permissions $arrPerm=getTablePermissions('WeeklyData'); if(!$arrPerm[1] && $selected_id==""){ return ""; } // combobox: WeekEndDate $combo_WeekEndDate = new DateCombo; $combo_WeekEndDate->DateFormat = "mdy"; $combo_WeekEndDate->MinYear = 1900; $combo_WeekEndDate->MaxYear = 2100; $combo_WeekEndDate->DefaultDate = date('Y-m-d', strtotime('last saturday')); $combo_WeekEndDate->MonthNames = $Translation['month names']; $combo_WeekEndDate->CSSOptionClass = 'Option'; $combo_WeekEndDate->CSSSelectedClass = 'SelectedOption'; $combo_WeekEndDate->NamePrefix = 'WeekEndDate'; $WeekEndDateToday=" [".$Translation['today']."]"; if($selected_id){ // mm: check member permissions if(!$arrPerm[2]){ return ""; } // mm: who is the owner? $ownerGroupID=sqlValue("select groupID from membership_userrecords where tableName='WeeklyData' and pkValue='".makeSafe($selected_id)."'"); $ownerMemberID=sqlValue("select lcase(memberID) from membership_userrecords where tableName='WeeklyData' and pkValue='".makeSafe($selected_id)."'"); if($arrPerm[2]==1 && getLoggedMemberID()!=$ownerMemberID){ return ""; } if($arrPerm[2]==2 && getLoggedGroupID()!=$ownerGroupID){ return ""; } // can edit? if(($arrPerm[3]==1 && $ownerMemberID==getLoggedMemberID()) || ($arrPerm[3]==2 && $ownerGroupID==getLoggedGroupID()) || $arrPerm[3]==3){ $AllowUpdate=1; }else{ $AllowUpdate=0; } $res = sql("select * from `WeeklyData` where `Record_ID_Week`='".makeSafe($selected_id)."'"); $row = mysql_fetch_array($res); $combo_WeekEndDate->DefaultDate = $row["WeekEndDate"]; }else{ } // code for template based detail view forms // open the detail view template if(($_POST['dvprint_x'] || $_GET['dvprint_x']) && $selected_id){ $templateCode=@implode('', @file('./templates/WeeklyData_templateDVP.html')); $dvprint=true; }else{ $templateCode=@implode('', @file('./templates/WeeklyData_templateDV.html')); $dvprint=false; } // process form title $templateCode=str_replace('<%%DETAIL_VIEW_TITLE%%>', 'Detail View', $templateCode); // process buttons if($arrPerm[1]){ // allow insert? $templateCode=str_replace('<%%INSERT_BUTTON%%>', '', $templateCode); }else{ $templateCode=str_replace('<%%INSERT_BUTTON%%>', '', $templateCode); } if($selected_id){ $templateCode=str_replace('<%%DVPRINT_BUTTON%%>', '', $templateCode); if($AllowUpdate){ $templateCode=str_replace('<%%UPDATE_BUTTON%%>', '', $templateCode); }else{ $templateCode=str_replace('<%%UPDATE_BUTTON%%>', '', $templateCode); // set records to read only if user can't insert new records if(!$arrPerm[1]){ $jsReadOnly.="tif(document.getElementsByName('Record_ID_Week').length){ document.getElementsByName('Record_ID_Week')[0].readOnly=true; }"; $jsReadOnly.="tif(document.getElementsByName('WeekEndDate').length){ document.getElementsByName('WeekEndDate')[0].readOnly=true; }"; $jsReadOnly.="tif(document.getElementsByName('WeekEndDateDay').length){ var WeekEndDateDay=document.getElementsByName('WeekEndDateDay')[0]; WeekEndDateDay.disabled=true; WeekEndDateDay.style.backgroundColor='white'; WeekEndDateDay.style.color='black'; }"; $jsReadOnly.="tif(document.getElementsByName('WeekEndDateMonth').length){ var WeekEndDateMonth=document.getElementsByName('WeekEndDateMonth')[0]; WeekEndDateMonth.disabled=true; WeekEndDateMonth.style.backgroundColor='white'; WeekEndDateMonth.style.color='black'; }"; $jsReadOnly.="tif(document.getElementsByName('WeekEndDateYear').length){ var WeekEndDateYear=document.getElementsByName('WeekEndDateYear')[0]; WeekEndDateYear.disabled=true; WeekEndDateYear.style.backgroundColor='white'; WeekEndDateYear.style.color='black'; }"; $jsReadOnly.="tif(document.getElementsByName('CP_RO_Count').length){ document.getElementsByName('CP_RO_Count')[0].readOnly=true; }"; $jsReadOnly.="tif(document.getElementsByName('CP_HRs').length){ document.getElementsByName('CP_HRs')[0].readOnly=true; }"; $jsReadOnly.="tif(document.getElementsByName('CustomerPay').length){ document.getElementsByName('CustomerPay')[0].readOnly=true; }"; $jsReadOnly.="tif(document.getElementsByName('Total_CP_Labor').length){ document.getElementsByName('Total_CP_Labor')[0].readOnly=true; }"; $jsReadOnly.="tif(document.getElementsByName('Total_CP_Parts').length){ document.getElementsByName('Total_CP_Parts')[0].readOnly=true; }"; $jsReadOnly.="tif(document.getElementsByName('Notes').length){ document.getElementsByName('Notes')[0].readOnly=true; }"; $noUploads=true; } } if(($arrPerm[4]==1 && $ownerMemberID==getLoggedMemberID()) || ($arrPerm[4]==2 && $ownerGroupID==getLoggedGroupID()) || $arrPerm[4]==3){ // allow delete? $templateCode=str_replace('<%%DELETE_BUTTON%%>', " "');">", $templateCode); }else{ $templateCode=str_replace('<%%DELETE_BUTTON%%>', '', $templateCode); } $templateCode=str_replace('<%%DESELECT_BUTTON%%>', "", $templateCode); }else{ $templateCode=str_replace('<%%UPDATE_BUTTON%%>', '', $templateCode); $templateCode=str_replace('<%%DELETE_BUTTON%%>', '', $templateCode); $templateCode=str_replace('<%%DESELECT_BUTTON%%>', ($ShowCancel ? "" : ''), $templateCode); } // process combos $templateCode=str_replace('<%%COMBO(WeekEndDate)%%>', $combo_WeekEndDate->GetHTML().($noUploads ? '' : $WeekEndDateToday), $templateCode); $templateCode=str_replace('<%%COMBOTEXT(WeekEndDate)%%>', $combo_WeekEndDate->GetHTML(true), $templateCode); // process foreign key links if($selected_id){ } // process images $templateCode=str_replace('<%%UPLOADFILE(Record_ID_Week)%%>', '', $templateCode); $templateCode=str_replace('<%%UPLOADFILE(WeekEndDate)%%>', '', $templateCode); $templateCode=str_replace('<%%UPLOADFILE(CP_RO_Count)%%>', '', $templateCode); $templateCode=str_replace('<%%UPLOADFILE(CP_HRs)%%>', '', $templateCode); $templateCode=str_replace('<%%UPLOADFILE(CustomerPay)%%>', '', $templateCode); $templateCode=str_replace('<%%UPLOADFILE(Total_CP_Labor)%%>', '', $templateCode); $templateCode=str_replace('<%%UPLOADFILE(Total_CP_Parts)%%>', '', $templateCode); $templateCode=str_replace('<%%UPLOADFILE(Notes)%%>', '', $templateCode); // process values if($selected_id){ $templateCode=str_replace('<%%VALUE(Record_ID_Week)%%>', htmlspecialchars($row['Record_ID_Week'], ENT_QUOTES), $templateCode); $templateCode=str_replace('<%%VALUE(WeekEndDate)%%>', date('n/j/Y', strtotime(htmlspecialchars($row['WeekEndDate'], ENT_QUOTES))), $templateCode); $templateCode=str_replace('<%%VALUE(CP_RO_Count)%%>', htmlspecialchars($row['CP_RO_Count'], ENT_QUOTES), $templateCode); $templateCode=str_replace('<%%VALUE(CP_HRs)%%>', htmlspecialchars($row['CP_HRs'], ENT_QUOTES), $templateCode); $templateCode=str_replace('<%%VALUE(CustomerPay)%%>', htmlspecialchars($row['CustomerPay'], ENT_QUOTES), $templateCode); $templateCode=str_replace('<%%VALUE(Total_CP_Labor)%%>', htmlspecialchars($row['Total_CP_Labor'], ENT_QUOTES), $templateCode); $templateCode=str_replace('<%%VALUE(Total_CP_Parts)%%>', htmlspecialchars($row['Total_CP_Parts'], ENT_QUOTES), $templateCode); $templateCode=str_replace('<%%VALUE(Notes)%%>', htmlspecialchars($row['Notes'], ENT_QUOTES), $templateCode); }else{ $templateCode=str_replace('<%%VALUE(Record_ID_Week)%%>', '', $templateCode); $templateCode=str_replace('<%%VALUE(WeekEndDate)%%>', '', $templateCode); $templateCode=str_replace('<%%VALUE(CP_RO_Count)%%>', '', $templateCode); $templateCode=str_replace('<%%VALUE(CP_HRs)%%>', '', $templateCode); $templateCode=str_replace('<%%VALUE(CustomerPay)%%>', '', $templateCode); $templateCode=str_replace('<%%VALUE(Total_CP_Labor)%%>', '', $templateCode); $templateCode=str_replace('<%%VALUE(Total_CP_Parts)%%>', '', $templateCode); $templateCode=str_replace('<%%VALUE(Notes)%%>', '', $templateCode); } // process translations foreach($Translation as $symbol=>$trans){ $templateCode=str_replace("<%%TRANSLATION($symbol)%%>", $trans, $templateCode); } // clear scrap $templateCode=str_replace('<%%', '', $templateCode); // hide links to inaccessible tables $templateCode.=""; // ajaxed auto-fill fields $templateCode.=""; $templateCode.=""; // handle enforced parent values for read-only lookup fields return $templateCode; } ?>
  9. MySQL Inport Question

    Anybody have any thoughts on this? Trying to get it figured out pretty soon.
  10. I know this question has been asked in lots of ways, lots of times... but need some help! Looking to import from an MySQL database that uses data like this: Here is the database layout: When I enter the following code though - I get a error saying: "Could not connect: Can't connect to MySQL server on 'localhost' (10061)" - so even though I am not sure if the code is correct can't connect to the data base? [/font][/size] <?php //We've included ../Includes/FusionCharts_Gen.php, which contains //FusionCharts PHP Class to help us easily embed charts //We've also used ../Includes/DBConn.php to easily connect to a database. include("FusionCharts_Gen.php"); include("DBConn.php"); //include 'dbc.php'; ?> <?php //You need to include the following JS file, if you intend to embed the chart using JavaScript. //Embedding using JavaScripts avoids the "Click to Activate..." issue in Internet Explorer //When you make your own charts, make sure that the path to this JS file is correct. //Else, you would JavaScript errors. ?> <?php //In this example, we show how to connect FusionCharts to a database. //For the sake of ease, we've used an MySQL databases containing two //tables. // Connect to the Database $link = connectToDB(); # Create pie 3d chart object using FusionCharts PHP Class $FC = new FusionCharts("Pie3D","650","450"); # Set Relative Path of chart swf file. $FC->setSwfPath(" "); //Store chart attributes in a variable for ease of use $strParam="caption=Factory Output report;subCaption=By Quantity;pieSliceDepth=30; showBorder=1;showNames=1;formatNumberScale=0;numberSuffix= Units;decimalPrecision=0"; # Set chart attributes $FC->setChartParams($strParam); // Fetch all factory records using SQL Query // Store chart data values in 'total' column/field // and category names in 'FactoryName' $strQuery = "select record_category, sum(record_amount) as total from record group by record_category"; echo $strQuery; echo " "; $result = mysql_query($strQuery) or die(mysql_error()); $i = 0; while($test = mysql_fetch_array($result)) { echo $test['record_category']." ".$test['total']; echo " "; $i++; } echo $i; echo " "; echo $row['total']; //Pass the SQL Query result to the FusionCharts PHP Class function //along with field/column names that are storing chart values and corresponding category names //to set chart data from database if ($result) { $FC->addDataFromDatabase($result, "total"); // $FC->addDataFromDatabase($result, "total", "record_category"); } mysql_close($link); # Render the chart $FC->renderChart(); ?> Does anybody have any advice on making sure that it connects to the database first?