php教程 mssql 数据库教程连接类代码
PHP5学习对象教程由美国人古曼兹、贝肯、瑞桑斯编著,简张桂翻译,电子工业出版社于2007年12月1日出版的关于PHP5应用程序的技术类图书。该书全面介绍了PHP 5中的新功能、编程方法及设计模式,还分析阐述了PHP 5中新的数据库连接处理、错误处理和XML处理等机制,帮助读者系统了解、熟练掌握和高效应用PHP。
291
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 = %sn", $Query_String);
1 2
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号