Home > Backend Development > PHP Tutorial > Parameter description of connecting MySQL code with PHP_PHP tutorial

Parameter description of connecting MySQL code with PHP_PHP tutorial

WBOY
Release: 2016-07-21 15:51:25
Original
1021 people have browsed it

The code is like this:

$link=mysql_connect("localhost","root","123456");
if(!$link) echo "No connection successful !";
else echo "Connection successful!";
?>
The red part can be modified according to your actual situation.

localhost: Indicates the location of the database. If it is the local machine, write localhost. If it is on another machine, write the IP address.
root: user name to enter the database. MySQL default user name is root.
123456: The password corresponding to the username. Modify this string of numbers according to the administrator password you set.
Of course, the codes mentioned above can only run successfully after configuring Apache + MySQL + PHP. Please pay attention.
Author: Sunec
Original Published by: Cenus Blog
All rights reserved. When reprinting, the author, original source and this statement must be indicated in the form of a link.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319137.htmlTechArticleThe code is like this: ?php $link=mysql_connect("localhost","root","123456") ; if(!$link)echo "No connection successful!"; elseecho "Connection successful!"; ? The red part can be based on your own actual...
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