Why are the execution results different for the following two sections of code? thank you! & lt ;? Php & nbsp; $ userNameroot; & nbsp; $ userPwd1234; & nbsp; $ dbNametest; & nbsp; $ serverNamelocalhost; connect to database & nbsp; $ connmysql_connect
$ UserName = "root ";
$ Userpwds = "1234 ";
$ DbName = "test ";
$ ServerName = "localhost ";
// Connect to the database
$ Conn = mysql_connect ("localhost", "root", "1234 ");
// Select a database
$ Select = mysql_select_db ("test", $ conn );
If ($ select ){
Echo "database connection successful ";
}
?>
Different from the following code execution results, please analyze $ UserName = "root ";
$ Userpwds = "1234 ";
$ DbName = "test ";
$ ServerName = "localhost ";
// Connect to the database
$ This-> conn = mysql_connect ($ this-> serverName, $ this-> userName, $ this-> userPwd );
// Select a database
$ This-> my_db = mysql_select_db ($ this-> dbName, $ this-> conn );
If ($ this-> my_db ){
Echo "database connection successful ";
}
?>
Share: More
------ Solution --------------------
At?> Before joining
}
new login;