Questions about $ coon connection

Source: Internet
Author: User
New users have two connection questions about $ coon & nbsp; for database connection, the first one is: $ db_hostlocalhost ;?? Database host name $ db_userroot ;? & Nbsp ;?? & Nbsp ;??? Database User account $ db_passw123 ;? & Nbsp ;? Database user password $ db_namelist ;? & Nbsp ;?? & Nbsp connection questions about $ coon
There are two types of database connections:
$ Db_host = 'localhost ';?? // Database host name
$ Db_user = 'root ';? ?? ??? // Database user account
$ Db_passw = '123 ';? ? // Database user password
$ Db_name = 'list ';? ?? ?? ? // Database details
$ Conn = mysql_connect ($ db_host, $ db_user, $ db_passw) or die ('database connection failed! ');

The second type is:
$ Conn = mysql_connect (localhost, root, 123) or die ('database connection failed! ');

Obviously, the second method is much more convenient than the first one. why do some people prefer the first one? is there any other purpose.
------ Solution --------------------
There are no two methods!
Careful people are reluctant to show others the password, so they use the variable.
Of course, in the real code, these variables are placed in places that you cannot see
------ Solution --------------------
Another explanation is that variables can be placed in a separate configuration file and then included to facilitate future management.
------ Solution --------------------
It's just a habit.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.