Novice connection issues with $coon
For database connections, I've found two types, the first of which are:
$db _host= ' localhost ';?? Database host Name
$db _user= ' root ';? ?? ??? Database user Account
$db _passw= ' 123 ';? ?//Database user password
$db _name= ' list ';? ?? ?? ?//Database specific
$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 is more convenient than the first one, why some people like to use the first kind of, is not what other uses.
------Solution--------------------
There are no two ways!
Cautious people are reluctant to let others see the password, so the variable is used
Of course, in real code, these variables are placed where you can't see them.
------Solution--------------------
Another explanation is that variables can be placed in a separate configuration file, which is then included so that it is easy to manage later.
------Solution--------------------
Don't be so tangled, it's a habit.
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.