View difference between Paste ID: 3j4zmHJY and HggfnKTa
SHOW: | | - or go back to the newest paste.
1
class mssqlClass {
2
	
3
	function connect($database = 'db') {
4
		$mssql_server = 'server';
5
		$mssql_data = array("UID" => 'uid',
6
			"PWD" => 'pwd',
7
			"Database" => $database);
8
		
9
		if(! ISSET ($this->connection)){
10
			return $this->connection = sqlsrv_connect($mssql_server, $mssql_data);
11
		}
12
		if(! $this->connection){
13
			return 'Failed to Connect to Host';
14
		}
15
	}
16
	
17
	function getData($query) {
18
		$this->data_array = array();
19
		$result = sqlsrv_query($this->connection, $query);
20
		while ($row =  sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC)) {
21
			$this->data_array[] = $row;                                                    
22
		}
23
		$m = $this->data_array;                 
24
		return $m;
25
	} 
26
	function query($query) {           
27-
		$result = sqlsrv_query($query) or die( prlols( sqlsrv_errors(), true));
27+
		$result = sqlsrv_query($query) or die( print_r( sqlsrv_errors(), true));
28
	}
29
30
}