Phpmssql database connection code (1/2) _ PHP Tutorial

Source: Internet
Author: User
Phpmssql database connection code (12 ). Php Tutorial mssql Database tutorial connection class code classDB_ SQL {var $ Host; var $ Database; var $ User; var $ Password; var $ Link_ID0; var $ Query_ID0; var $ Recordarr php Tutorial mssql database tutorial connection class code

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

Mssql Database tutorial connection class code class DB_ SQL {var $ Host =; var $ Database =; var $ User =; var $ Password =; var $ Link_ID = 0; var $ Query_ID = 0; var $ Record = arr...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.