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...