update : 2015.11.03
php.shukuma.com

검색:
 
 
별칭: mysqli::__construct

mysqli_connect

(PHP 5)

mysqli_connect별칭: mysqli::__construct()

설명

이 함수는 다음 함수의 별칭입니다: mysqli::__construct()

Although the mysqli::__construct() documentation also includes procedural examples that use the mysqli_connect() function, here is a short example:

예제

Example #1 mysqli_connect() example

<?php
$link 
mysqli_connect("127.0.0.1""my_user""my_password""my_db");

if (!
$link) {
    echo 
"Error: Unable to connect to MySQL." PHP_EOL;
    echo 
"Debugging errno: " mysqli_connect_errno() . PHP_EOL;
    echo 
"Debugging error: " mysqli_connect_error() . PHP_EOL;
    exit;
}

echo 
"Success: A proper connection to MySQL was made! The my_db database is great." PHP_EOL;
echo 
"Host information: " mysqli_get_host_info($link) . PHP_EOL;

mysqli_close($link);
?>

위 예제들의 출력:

Success: A proper connection to MySQL was made! The my_db database is great.
Host information: localhost via TCP/IP