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.