-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathmysqli.inc
More file actions
40 lines (37 loc) · 870 Bytes
/
mysqli.inc
File metadata and controls
40 lines (37 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* php -mod-mysqli test/generic functions
*/
/** ---------------------------------- Tests functions -------------------------------------------- */
function get_mysqli_conn()
{
$cfg = array(
'host'=>'localhost',
'port'=>3306,
'database'=>'test',
'username'=>'root',
'password'=>'root',
);
if (is_file('mysqli-conn.ini')){
$cfg=parse_ini_file('mysqli-conn.ini');
// print_r($cfg);
}
// print_r($cfg);
try{
$conn = @mysqli_connect($cfg['host'], $cfg['username'], $cfg['password'], $cfg['database'], $cfg['port']);
} catch (Exception $e) {
$conn = false;
}
return $conn;
}
function get_mysqli_version()
{
$c = get_mysqli_conn();
if ($c){
$infos = mysqli_get_server_info($c);
$infoc = mysqli_get_client_info($c);
// print_r($info);
return 'server: '.$infos.'; client: '.$infoc;
}
return false;
}