php-src/ext/mysql/tests/skipifconnectfailure.inc

17 lines
501 B
PHP
Raw Normal View History

2007-10-10 09:49:37 +00:00
<?php
require_once('connect.inc');
2007-10-10 09:49:37 +00:00
if ($skip_on_connect_failure) {
if ($socket)
$myhost = sprintf("%s:%s", $host, $socket);
else if ($port)
$myhost = sprintf("%s:%s", $host, $port);
2007-10-10 09:49:37 +00:00
if (!$link = @mysql_connect($myhost, $user, $passwd, true))
die(sprintf("skip Can't connect to MySQL Server - [%d] %s", mysql_errno(), mysql_error()));
if (!@mysql_select_db($db, $link))
die(sprintf("skip Can't connect to MySQL Server - [%d] %s", mysql_errno(), mysql_error()));
2007-10-10 09:49:37 +00:00
mysql_close($link);
}
?>