Home > headlines > body text

Detailed explanation of php mysql operation mysql_connect to connect to the database instance

无忌哥哥
Release: 2018-06-27 15:03:14
Original
2423 people have browsed it

mysql_connect introduction

php mysql_connect is used to connect to the mysql server. This function has multiple parameters, but we generally only need to understand the following three parameters:

mysql_connect(server,user ,pwd)

Parameter introduction:

server -- mysql server address

user -- server user name

pwd - - Server login password

If the connection is successful, a MySQL connection ID is returned, if the connection fails, FALSE is returned.

mysql_connect instance

<?php
$host="mysql153.secureserver.net";
$uname="root";
$pass="password";
$connection= mysql_connect ($host, $uname, $pass);
if (! $connection) {
 die ("mysql服务器连接失败");
} else {
 echo "恭喜你!mysql服务器连接成功";
}
?>
Copy after login

Thank you for reading, I hope it can help everyone, thank you for your support of this site!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template