Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
349 views
in Technique[技术] by (71.8m points)

php - Call to undefined function 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...