Browse Source

Fix for #158 (proper)

Maurits van der Schee 8 years ago
parent
commit
b18b226219
1 changed files with 2 additions and 3 deletions
  1. 2
    3
      api.php

+ 2
- 3
api.php View File

94
 
94
 
95
 	public function connect($hostname,$username,$password,$database,$port,$socket,$charset) {
95
 	public function connect($hostname,$username,$password,$database,$port,$socket,$charset) {
96
 		$db = mysqli_init();
96
 		$db = mysqli_init();
97
-		$option = constant('MYSQLI_OPT_INT_AND_FLOAT_NATIVE');
98
-		if ($option!==null && !mysqli_options($db,$option,true)) {
99
-			throw new \Exception('Error setting int and float native. '.mysqli_error($db));
97
+		if (defined('MYSQLI_OPT_INT_AND_FLOAT_NATIVE')) {
98
+			mysqli_options($db,MYSQLI_OPT_INT_AND_FLOAT_NATIVE,true);
100
 		}
99
 		}
101
 		$success = mysqli_real_connect($db,$hostname,$username,$password,$database,$port,$socket,MYSQLI_CLIENT_FOUND_ROWS);
100
 		$success = mysqli_real_connect($db,$hostname,$username,$password,$database,$port,$socket,MYSQLI_CLIENT_FOUND_ROWS);
102
 		if (!$success) {
101
 		if (!$success) {

Loading…
Cancel
Save