i upgradefrom php version 2.2 to 2.4 and php 5.6 too. The problem is with the new php the function does not support mssql_connect so i installed the new driver for sqlsvr and when i made the Database connection it work fine.
I need some help. How can I change this code from mssql to sqlsvr thanks you and i waiting for your answer.
<?php
class C_DBHandler
{
private $db_Host = ""; // Host, auf dem die DB läuft
private $db_Database = ""; // zu verwendetende Database
private $db_User = ""; // User und Paßwort für Login
private $db_Password = "";
private $db_Link = 0; // Resultat des connect()
private $db_Query = 0; // Resultat des query()
private $db_Record = array(); // aktuelles fetch_array()-Ergebnis
private $db_Row; // Aktuelle Ergebniszeile
private $db_numRows = "";
private $LSDconf = "";
private $LSDDBconf = "";
private static $instance; // Klasseninstanzname
public function __get($property){
$Err = C_GetHDL();
$Err->SetSubject("LSD-Error (property)");
$Err->SetBody("Attempt to read from not existing property \"$property\". Class: \"".__CLASS__."\"; Triggered by User: \"".$_SESSION['ULogin']."\"");
$Err->SendAdminInfo("mail_db");
}
public function __set($property, $val){
$Err = C_FuncHandler::GetHDL();
$Err->SetSubject("LSD-Error (property)");
$Err->SetBody("Attempt to write \"$val\" to not existing property \"$property\". Class: \"".__CLASS__."\"; Triggered by User: \"".$_SESSION['ULogin']."\"");
$Err->SendAdminInfo("mail_db");
}
function __autoload($className){
$fileName = $className.'.inc';
require($fileName);
}
private function __construct(){
require ('config.inc');
require ('DB-config.inc');
$this->LSDconf = $LSDconf;
$this->LSDDBconf = $LSDDBconf;
}
public function __clone()
{
trigger_error('Clone is not allowed.', E_USER_ERROR);
}
public static function GetHDL()
{
if (!isset(self::$instance)) {
$c = __CLASS__;
self::$instance = new $c;
}
return self::$instance;
}
private function connect() {
$this->db_Host = $this->LSDDBconf['DBSec']['host'];
$this->db_Database = $this->LSDDBconf['DBSec']['dbname'];
$this->db_Password = $this->LSDDBconf['DBSec']['pwd'];
$this->db_User = $this->LSDDBconf['DBSec']['user'];
if ( 0 == $this->db_Link ) {
$this->db_Link=mssql_connect($this->db_Host, $this->db_User, $this->db_Password);
if (!$this->db_Link) {
die("<br><br><b><font color=\"red\">Invalid SQL connect-DB</font></b>");
}
if (!mssql_select_db($this->db_Database,$this->db_Link)) { $Err->SendAdminInfo("mail_db");
die("<br><br><b><font color=\"red\">Invalid SQL select-DB</font></b>");
}
}
}
public function query($Query_String) {
$this->connect();
$this->db_Query = mssql_query($Query_String,$this->db_Link);
$this->db_Row = 0;
if (!$this->db_Query) {
die("<br><br><b><font color=\"red\">Invalid SQL Query</font></b>");
}
return $this->db_Query;
}
public function next_record() {
$this->db_Record = mssql_fetch_array($this->db_Query);
$this->db_Row += 1;
return $this->db_Record;
}
public function num_rows(){
$this->db_numRows = mssql_num_rows($this->db_Query);
return $this->db_numRows;
}
public function rows_affected(){
$this->db_Query = mssql_query("SELECT @@ROWCOUNT", $this->db_Link);
$this->db_numRows = mssql_fetch_row($this->db_Query);
return $this->db_numRows[0];
}
public function mssql_addslashes($MyString) {
$MyString = str_replace("'", "''", $MyString);
return $MyString;
}
public function Setdb_Query($val){
$this->db_Query = $val;
}
public function Getdb_Query(){
return $this->db_Query;
}
}
?>