- if ($host) {
- $string .= " host=$host";
- }
-
- if ($port) {
- $string = "$string port=" . $port;
- }
-
- $link = pg_connect($string);
-
- return $link;
-
- } else if ($type == "mysql") {
- if (function_exists("mysqli_connect")) {
- if ($port)
- return mysqli_connect($host, $user, $pass, $db, $port);
- else
- return mysqli_connect($host, $user, $pass, $db);
-
- } else {
- $link = mysql_connect($host, $user, $pass);
- if ($link) {
- $result = mysql_select_db($db, $link);
- if ($result) return $link;
- }
- }
- }