数据库连接的学习笔记

Original 2018-11-09 11:32:39 166
abstract:<?php//加上@符 报错信息不回显示$db = @mysqli_connect('127.0.0.1','root','root','phpcn','3306','');//不加的话会显示报错的行数//$db = mysqli_connect('127.0.0.1','

<?php


//加上@符 报错信息不回显示

$db = @mysqli_connect('127.0.0.1','root','root','phpcn','3306','');


//不加的话会显示报错的行数

//$db = mysqli_connect('127.0.0.1','root','root1','phpcn','3306','');



//mysqli_connect_error() 输出错误原因 不显示第几行


if(!$db){

exit('数据库连接失败'.mysqli_connect_error());

}



mysqli_close($db);


print_r($db);


Release Notes

Popular Entries