WebRoot/FusionChartsFree/Code/PHP/DB_JS/Default.php

(开头部分) 7KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php
//We've included ../Includes/FusionCharts.php and ../Includes/DBConn.php, which contains
//functions to help us easily embed the charts and connect to a database.
include("../Includes/FusionCharts.php");
include("../Includes/DBConn.php");
?>
<HTML>
<HEAD>	
    <TITLE>
    FusionCharts Free - Database + JavaScript Example
    </TITLE>

    <?php
    //In this example, we show a combination of database + JavaScript rendering using FusionCharts.

    //The entire app (page) can be summarized as under. This app shows the break-down
    //of factory wise output generated. In a pie chart, we first show the sum of quantity
    //generated by each factory. These pie slices, when clicked would show detailed date-wise
    //output of that factory.

    //The XML data for the pie chart is fully created in PHP at run-time. PHP interacts
    //with the database and creates the XML for this.
    //Now, for the column chart (date-wise output report), we do not submit request to the server.
    //Instead we store the data for the factories in JavaScript arrays. These JavaScript
    //arrays are rendered by our PHP Code (at run-time). We also have a few defined JavaScript
    //functions which react to the click event of pie slice.

    //We've used an MySQL databasw which contains two databases. 

    //Before the page is rendered, we need to connect to the database and get the
    //data, as we'll need to convert this data into JavaScript variables.
    $link = connectToDB();

    //The following string will contain the JS Data and variables.
    //This string will be built in PHP and rendered at run-time as JavaScript.
    $jsVarString = "";

    //Generate the chart element
    $strXML = "<graph caption='Factory Output report' subCaption='By Quantity' decimalPrecision='0' showNames='1' numberSuffix=' Units' pieSliceDepth='20' formatNumberScale='0' >";

    //initialize index
    $indexCount = 0;

    // Fetch all factory records
    $strQuery = "select * from Factory_Master";
    $result = mysql_query($strQuery) or die(mysql_error());

    //Iterate through each factory
    if ($result) {
        while($ors = mysql_fetch_array($result)) {

            $indexCount++;

            //Create JavaScript code to add sub-array to data array
            //data is an array defined in JavaScript (see below)
            //We've added \t and \n to data so that if you View Source of the
            //output HTML, it will appear properly. It helps during debugging
            $jsVarString .= "\t\t data[" . $indexCount . "] = new Array(); \n";

            //Now create second query to get date-wise details for this factory
后面还有 119 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。