-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathmysql.inc
More file actions
41 lines (37 loc) · 910 Bytes
/
mysql.inc
File metadata and controls
41 lines (37 loc) · 910 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
41
<?php
/**
* php -mod-mysql test/generic functions
*/
/** ---------------------------------- Tests functions -------------------------------------------- */
static $myconn=null;
function get_mysql_conn()
{
global $myconn;
$cfg = array(
'host'=>'localhost',
'port'=>3306,
'database'=>'test',
'username'=>'root',
'password'=>'root',
);
if (is_file('mysql-conn.ini')){
$cfg=parse_ini_file('mysql-conn.ini');
// print_r($cfg);
}
// print_r($cfg);
$myconn = @mysql_connect($cfg['host'].':'.$cfg['port'], $cfg['username'], $cfg['password'], true);
if ($myconn)
mysql_select_db($cfg['database'], $myconn);
return $myconn;
}
function get_mysql_version()
{
$c = get_mysql_conn();
if ($c){
$infos = mysql_get_server_info($c);
$infoc = mysql_get_client_info();
// print_r($info);
return 'server: '. $infos.'; client: '.$infoc;
}
return false;
}