public static function getDb($n) { if (!Model::$DB) { $db = new mysql_db(); $db->sql_connect(ooxx::get('DB_HOST'), ooxx::get('DB_USER'), ooxx::get('DB_PWD'), ooxx::get('DB_NAME')); Model::$DB = $db; } else { $db = Model::$DB; } $db->_sql = array(); $db->_sql['table'] = $n; return $db; }
<div id="wordlist" class="officelist"> <span>OFFICE文件列表:</span> <table class="tabletitle"> <tr><td width="25%">文 件 标 题</td><td width="30%">文 件 类 型</td><td width="20%">文 件 大 小</td><td width="25%">相 关 操 作</td></tr> <?php require 'connectionInfo.php'; //添加引用文件 mb_internal_encoding('utf-8'); // $query = 'select * from '.$officeFileInfoTableName.' order by filetype;'; //写入sql语句 $query = 'select * from ' . $officeFileInfoTableName; //写入sql语句 /* Example */ //<!--读取数据库中的文件--> $DB = new mysql_db(); //建立数据库辅助类 $DB->sql_connect($ip, $sqlname, $sqlpw, $dbname); //建立一个新连接 $DB->query($query); //执行sql $rs = $DB->sql_result(); /* 处理结果集 */ while ($row = mysql_fetch_array($rs, MYSQL_BOTH)) { // echo "<tr><td>{$row['id']}</td><td>{$row['filename']}</td><td>{$row['filetype']}</td><td>{$row['filesize']}</td><td><a href=\'javascript:showFileEditPage(\"FileEdit.php?FileId={{$row['id']}}\",900,800);\' > 编辑 </a></td></tr>"; echo '<tr><td>' . $row['filename'] . '</td><td>' . $row['filetype'] . '</td><td>' . $row['filesize'] . '</td><td><a href="javascript:showFileEditPage(\'FileEdit.php?FileId=' . $row['id'] . '\',900,800);">编辑</a></td></tr>'; } ?> <tr><td> </td><td> </td><td> </td><td> </td></tr> </table> <table> <!--office文件列表--> </table>
<title>PHP Google Charts</title> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet"> </head> <body> <h1>PHP Google Charts</h1> <?php require_once 'classes/classGRAPH.php'; require_once 'classes/classDB.php'; $hostname = "<host>:<port>"; $username = "******"; $password = "******"; $dbname = "<database>"; $objDB = new mysql_db(); $objDB->sql_connect($hostname, $username, $password, $dbname); $ColumnChart = new Graph(); $ColumnChart->set_graphTitle("Hits Summary"); $ColumnChart->set_graphXLabel("Hour"); $ColumnChart->set_graphYLabel("Total Hits"); $ColumnChart->set_chartColumns(array("Hour", "Total Hits")); $result = $objDB->query("select Hour(datetime) as hour, count(*) as hits from hits group by 1 order by 1 desc;"); $index = 0; while ($line = $objDB->fetch_row($result)) { $rows[$index][0] = $line['hour']; $rows[$index][1] = $line['hits']; $index++; } $ColumnChart->set_chartRows($rows); $ColumnChart->set_chartGraph("ColumnChart"); $ColumnChart->get_chartGraph();