代码执行错误
//php操作mysqli
//1连接数据库
$mysqli=new mysqli("localhost","root","","test4");
var_dump($mysqli);
//2执行sql语句
//3获取结果
Warning: mysqli::__construct(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO) in D:\phpStudy\WWW\MYSQL2\1.php on line 11
Warning: var_dump(): Property access is not allowed yet in D:\phpStudy\WWW\MYSQL2\1.php on line 12
Warning: var_dump(): Property access is not allowed yet in D:\phpStudy\WWW\MYSQL2\1.php on line 12
Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 12
Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 12
Warning: var_dump(): Property access is not allowed yet in D:\phpStudy\WWW\MYSQL2\1.php on line 12
Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 12
Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 12
Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 12
Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 12
Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 12
Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 12
Warning: var_dump(): Property access is not allowed yet in D:\phpStudy\WWW\MYSQL2\1.php on line 12
Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 12
Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 12
Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 12
Warning: var_dump(): Couldn't fetch mysqli in D:\phpStudy\WWW\MYSQL2\1.php on line 12
object(mysqli)#1 (19) { ["affected_rows"]=> NULL ["client_info"]=> NULL ["client_version"]=> int(50012) ["connect_errno"]=> int(1045) ["connect_error"]=> string(62) "Access denied for user 'root'@'localhost' (using password: NO)" ["errno"]=> NULL ["error"]=> NULL ["error_list"]=> NULL ["field_count"]=> NULL ["host_info"]=> NULL ["info"]=> NULL ["insert_id"]=> NULL ["server_info"]=> NULL ["server_version"]=> NULL ["stat"]=> NULL ["sqlstate"]=> NULL ["protocol_version"]=> NULL ["thread_id"]=> NULL ["warning_count"]=> NULL }
这个是什么原因呢
正在回答 回答被采纳积分+1
- 参与学习 人
- 提交作业 225 份
- 解答问题 3372 个
掌握用PHP开发互联网网站的必备功能,掌握当下主流的Linux系统开发,并熟练使用热门框架ThinkPhp开发电商团购项目,是通向PHP工程师必经之路。
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星