Home >Backend Development >PHP Tutorial > 下面有两段代码为什么执行结果不一样,帮解释,多谢

下面有两段代码为什么执行结果不一样,帮解释,多谢

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:31:46848browse

下面有两段代码为什么执行结果不一样,帮解释,谢谢
 $userName="root";
 $userPwd="1234";
  $dbName="test";
 $serverName="localhost";
//连接数据库
 $conn=mysql_connect("localhost","root","1234");
//选择数据库
$select=mysql_select_db("test",$conn);
if($select){
echo"数据库连接成功";
}
?>
和下面的代码执行结果不同,请分析下         $userName="root";
 $userPwd="1234";
  $dbName="test";
 $serverName="localhost";

    //连接数据库
    $this->conn=mysql_connect($this->serverName,$this->userName,$this->userPwd);
//选择数据库
$this->my_db=mysql_select_db($this->dbName,$this->conn);
     if($this->my_db){
echo"数据库连接成功";
               }
?>

Statement:
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