简述Mysql_connect与Mysqli_connect的区别,用一个相同的查询内容来表述,看下面的例子:
mysql_connect:
$connection_setup = mysql_connect($serveraddress . ':' . $serverport,$serveruser,$serverpass)or die(mysql_error()); mysql_select_db($server_adb,$connection_setup)or die(mysql_error()); mysql_query("set names utf8"); $server_forwow = mysql_fetch_assoc(mysql_query("SELECT * FROM realmlist WHERE id = '".$serverid."'"));
mysqli_connect:
$connection_setup = mysqli_connect($serveraddress.':'.$serverport,$serveruser,$serverpass)or die(mysqli_connect_errno()); mysqli_select_db($connection_setup,$server_adb)or die(mysqli_connect_errno()); mysqli_query($connection_setup, "set names utf8"); $server_forwow=mysqli_fetch_assoc(mysqli_query($connection_setup,"SELECT * FROM realmlist WHERE id = '".$serverid."'"));
自PHP5.5开始,使用mysql_connect将在log里予以警告,要求尽快更新到mysqli_connect,在未来将被移除。