|
文件: | amcolumn.rar |
大小: | 162KB |
下载: | 下载 |
|
example.php://说明:
//1、先运行本php文件中的代码,生成想要展现的数据。随后,在Html文件中插入一对
即可,请参见aucolumn.html文件
//2、导出flash图表为图片功能仅限于程序运行于服务器之上才能正常使用
//3、该图针对的是两行数据统计,比如年份/产量。其它多数据请改用别的图表,联系我
//4、软件被我破解,没有版权显示了
//Good Luck!
include('./amcolumn/chart.php');
$link = new getConn('localhost(主机名或IP地址)','test(数据库名)','root(数据库用户名)','(数据库密码)');
$link->getResult('select * from sum(sql语句)');
?>
chart.php:
class getConn{
private $host;
private $dbname;
private $dbuser;
private $dbpass;
public function __construct($_host,$_dbname,$_dbuser,$_dbpass){
$this->host = $_host;
$this->dbname = $_dbname;
$this->dbuser = $_dbuser;
$this->dbpass = $_dbpass;
}
public function getResult($_sql){
$con = mysql_connect($this->host,$this->dbuser,$this->dbpass);
mysql_select_db($this->dbname,$con);
$result = mysql_query($_sql,$con);
while($array[] = mysql_fetch_row($result));
$this->putOutCsv($array);
}
public function putOutCsv($arrayIn){
for($i=0;$i $arrayIn[$i] = @array_slice($arrayIn[$i],1);
}
foreach($arrayIn as $tmp){
$list[] = @implode(',',$tmp);
}
$fp = fopen('./amcolumn/amcolumn_data.txt','w');
foreach($list as $line)
if(!fputcsv($fp,split(',',$line),';')){
echo '导入文件错误';die();
}
echo '操作成功';
fclose($fp);
}
}
?>
阅读(2170) | 评论(0) | 转发(0) |