user2752347
user2752347

Reputation: 171

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\nStack trace:\n#0 {main}\n  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?

Upvotes: 3

Views: 8785

Answers (1)

Your Common Sense
Your Common Sense

Reputation: 157887

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

Upvotes: 5

Related Questions