//备份还原函数
代码如下 | 复制代码 |
function write_file($sql,$filename) { header("content-disposition: ".(strpos($_server['http_user_agent'], 'msie') ? 'inline; ' : 'attachment; ')."filename=".$filename); header("content-length: ".strlen($sql)); header("expires: 0"); function writeable($dir){ function make_header($table){ function make_record($table,$num_fields){ function show_msg($msgs){ function pageend(){ function import($fname) { |
----在这里,复制ntwdblib.dll到c:windowssystem32下是失败,原因是该目录下已经存在该dll文件啦.
我重启apache,
*/
$hostname="10.4.250.20";
$dbuser="hr";
$dbpasswd="946138";
$dbname="hr";
$conn = mssql_connect($hostname,$dbuser,$dbpasswd) or die("数据库连接错误!");
mssql_select_db($dbname,$conn);
$sql = " select * from pip_staff_s where cstaffid ='z797' ";
$rowset=mssql_query($sql,$conn);
$rowcnt=mssql_num_row($rowset);
echo " rows ";
echo $rowset;
echo " end ";
代码如下 | 复制代码 |
class dbstuff { if($this->version() > '4.1') { if($dbcharset) { if($this->version() > '5.0.1') { if($dbname) { } function select_db($dbname) { function fetch_array($query, $result_type = mysql_assoc) { function query($sql, $type = '') { $func = $type == 'unbuffered' && @function_exists('mysql_unbuffered_query') ? $this->querynum++; function affected_rows() { function error() { function errno() { function result($query, $row) { function result_first($sql) { function num_rows($query) { function num_fields($query) { function free_result($query) { function insert_id() { function fetch_row($query) { function fetch_fields($query) { function version() { function close() { function nr($sql_id="") { function nf($sql_id="") { function nextrecord($sql_id="") { function f($name) { function lock($tblname,$op="write") { function unlock() function ar() { function i_id() { function halt($message = '', $sql = '') { ?> |
代码如下 | 复制代码 |
*/ /** return $this -> conn; /** $this -> querynum++; /** /** /** /** /** /** /** function close() { /** /** /** ?> |
require_once 'excel/reader.php';
// excelfile($filename, $encoding);
$data = new spreadsheet_excel_reader();
// set output encoding.
$data->setoutputencoding('cp1251');
$data->read('jxlrwtest.xls');
error_reporting(e_all ^ e_notice);
for ($i = 1; $i <= $data->sheets[0]['numrows']; $i++) {
for ($j = 1; $j <= $data->sheets[0]['numcols']; $j++) {
echo """.$data->sheets[0]['cells'][$i][$j]."",";
}
echo " ";
}
格式化输出格式
/***
* some function for formatting output.
* $data->setdefaultformat('%.2f');
* setdefaultformat - set format for columns with unknown formatting
*
* $data->setcolumnformat(4, '%.3f');
* setcolumnformat - set format for column (apply only to number fields)
*
**/
统计总行数与按列名输出。
$data->sheets[0]['numrows'] - count rows
$data->sheets[0]['numcols'] - count columns
$data->sheets[0]['cells'][$i][$j] - data from $i-row $j-column
$data->sheets[0]['cellsinfo'][$i][$j] - extended info about cell
$data->sheets[0]['cellsinfo'][$i][$j]['type'] = "date" | "number" | "unknown"
if 'type' == "unknown" - use 'raw' value, because cell contain value with format '0.00';
$data->sheets[0]['cellsinfo'][$i][$j]['raw'] = value if cell without format
$data->sheets[0]['cellsinfo'][$i][$j]['colspan']
$data->sheets[0]['cellsinfo'][$i][$j]['rowspan']