php mssql 数据库连接类代码(1/2)_PHP教程
class DB_Sql {
var $Host = "";
var $Database = "";
var $User = "";
var $Password = "";var $Link_ID = 0;
var $Query_ID = 0;
var $Record = array();
var $Row = 0;
var $Errno = 0;
var $Error = "";var $Auto_Free = 0; ## set this to 1 to automatically free results
/* public: constructorwww.bKjia.c0m */
function DB_Sql($query = "") {
$this->query($query);
}function connect() {
if ( 0 == $this->Link_ID ) {
$this->Link_ID=mssql_connect($this->Host, $this->User, $this->Password);
if (!$this->Link_ID)
$this->halt("Link-ID == false, mssql_pconnect failed");
else
@mssql_select_db($this->Database, $this->Link_ID);
}
}
function free_result(){
mssql_free_result($this->Query_ID);
$this->Query_ID = 0;
}
function query($Query_String)
{
/* No empty queries, please, since PHP4 chokes on them. */
if ($Query_String == "")
/* The empty query string is passed on from the constructor,
* when calling the class without a query, e.g. in situations
* like these: '$db = new DB_Sql_Subclass;'
*/
return 0;if (!$this->Link_ID)
$this->connect();
# printf("
Debug: query = %s
n", $Query_String);
1 2
上一篇: php无限分类使用concat如何实现,php无限分类concat
下一篇: Linux服务器开发环境搭建 Nginx+PHP+MongoDB linux 连接mongodb mongodb安装教程 mongod
推荐阅读
-
PHP类(Class)入门教程第1/2页
-
PHP 分页类代码(简单好用型)第1/2页
-
php的mssql数据库连接类实例
-
PHP_MySQL教程-第二天while循环与数据库操作第1/2页
-
几种常用PHP连接数据库的代码示例_PHP教程
-
最简便的MySql数据库备份方法MySQLdump第1/2页_PHP教程
-
php文件上传类与详解(1/2)_PHP教程
-
php连接mysql数据库类_PHP教程
-
在Navicat premium上创建的SQL Server数据库,实现用PHP连接(即php连接微软MSSQL),navicatpremium_PHP教程
-
基于GD2图形库的PHP生成图片缩略图类代码分享,_PHP教程