php 连接数据库的类
<?php
class Access//Access数据库操作类
{
var $databasepath,$constr,$dbusername,$dbpassword,$link;//类的属性
function Access($databasepath,$dbusername,$dbpassword)//构造函数
{
$this->databasepath=$databasepath;
$this->username=$dbusername;
$this->password=$dbpassword;
$this->connect();
}
function connect()//数据库连接函数
{
$this->constr="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath($this->databasepath);
$this->link=odbc_connect($this->constr,$this->username,$this->password,SQL_CUR_USE_ODBC);
return $this->link;
//if($this->link) echo "恭喜你,数据库连接成功!";
//else echo "数据库连接失败!";
}
function query($sql)//送一个查询字符串到数据库中
{
return @odbc_exec($this->link,$sql);
}
function first_array($sql)//从access数据库中返回一个数组
{
return @odbc_fetch_array($this->query($sql));
}
function fetch_row($query)//返回记录中的一行
{
return odbc_fetch_row($query);
}
function total_num($sql)//取得记录总数
{
return odbc_num_rows($this->query($sql));
}
function close()//关闭数据库连接函数
{
odbc_close($this->link);
}
function insert($table,$field)//插入记录函数
{
$temp=explode(',',$field);
$ins='';
for ($i=0;$i<count($temp);$i++)
{
$ins.="'".$_POST[$temp[$i]]."',";
}
$ins=substr($ins,0,-1);
$sql="INSERT INTO ".$table." (".$field.") VALUES (".$in
相关文档:
伪静态用到知识很简单一旦学会,快乐无穷,只需要正则和服务器设置。
先说iis如何设置吧,往下看
下载(IIS Rewrite模块): http://www.isapirewrite.com/,先把产品下载下来,安装在服务器上,记住目录,会有类似Rewrite.dll的文件生成,MMC→IIS信息服务管理器→网站→您的站点→属性,在&ld ......
一般的文件安全下载方法可以使用下面的代码:
1. <?php?
2.
3. $durl = 'file/phpcms2008_o2abf32efj883c91a.iso';
4. $filename = 'phpcms2008_o2abf32efj883c91a.iso';
5. $file = @fopen($durl, 'r');
6. header("Content-Type: application/octet-stream");
......
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 92160 bytes) in :\Inetpub\wwwroot04\test.php on line 8
Fatal error: Out of memory (allocated 259,260,416) (tried to allocate 16 bytes) in C:\Inetpub\wwwroot04\test.php on line 8
//ini_set('memory_limit', '-1');
$inde ......
<?php
//作者:梁文平 http://www.tyasp.net
session_start();
if($_SESSION["username"]!="admin")
{
echo("<mce:script type="text/javascript"><!--
alert("操作超时!请重新登陆...");window.location.href="../index.php";
// --></mce:script>");
//header("refresh:0;url=../"); ......
excel这类文件其实就是特殊格式的文本文件(应该所有格式都是特殊格式的文本文件和二进制文件),
excel不同的行体现在文本中的换行,里面的需要转义的字符包括,\和\r\n这两个,遇到这些字符的时候这个单元格需要用""格开 ......