dream8877
2017-02-13 05:27
浏览 104
已采纳

调用未定义的函数mysqli()

The issue occurs with this code

<?php
define('DB_USER','root');
define('DB_PASSWORD','censored');
define('DB_HOST','localhost');
define('DB_NAME','censored');

$dbc = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
?>

I have installed php7.0-mysqli but I still get this error message

PHP Fatal error:  Uncaught Error: Call to undefined function mysqli() in /var/www/html/actions/create_account.php:29
Stack trace:
#0 {main}
  thrown in /var/www/html/actions/create_account.php on line 29, referer: http://localhost/register.php

Here is phpinfo() output on mysqli. enter image description here What is going wrong?

图片转代码服务由CSDN问答提供 功能建议

此代码出现问题

 &lt;?php  
define( 'DB_USER', '根'); 
define( 'DB_PASSWORD', '审查'); 
define( 'DB_HOST', '本地主机'); 
define( 'DB_NAME', '审查'); 
  
 $ dbc = new mysqli(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME); 
?&gt; 
   
 
 

我已安装php7.0-mysqli但我仍然 得到此错误消息

  PHP致命错误:未捕获错误:调用/var/www/html/actions/create_account.php:29中的未定义函数mysqli()跟踪 :
#0 {main} 
在第29行的/var/www/html/actions/create_account.php中引用,引用:http://localhost/register.php 
   \  n 
 

这是mysqli上的phpinfo()输出。 出了什么问题?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dqhnp44220 2017-02-13 05:52
    已采纳

    The error message is crystal clear: there is no such function in PHP and never has been. There is only a function called mysqli_connect() and class called mysqli. But classes are not functions and have different syntax to handle

    It means that, according to the error message, somewhere in the /var/www/html/actions/create_account.php on line 29 there is an improper call to mysqli

    已采纳该答案
    打赏 评论

相关推荐 更多相似问题