简体   繁体   English

无法连接到 mysqli php 有什么问题

[英]can't connecting to mysqli php What's wrong there

This is my code:这是我的代码:

<?php
$connection = mysqli_connect('localhost','root','','cms'); 

if($connection){
  echo "Error : unable to connect to mysqli.".PHP_EOL;
  echo "Debugging errno".mysqli_connect_errno().PHP_EOL;
  echo "Debugging error".mysqli_connect_error().PHP_EOL;
  exit;
}
?>

And I'm getting the following error:我收到以下错误:

Error : unable to connect to mysqli.错误:无法连接到 mysqli。 Debugging errno0 Debugging error调试 errno0 调试错误

Brother your connection is successful , you just need to use -兄弟你连接成功了,你只需要使用-

if(!$connection) instead of if($connection) if(!$connection) 而不是 if($connection)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM