函数未定义,MYSQL错误


Undefined function, MYSQL error

在提交以下表格时,我会收到此错误:

致命错误:调用…中未定义的函数mysqli_connect()。。。。第7行的mailing_list_include.php

这是mailing_list_include.php文件,真正的文件包括访问数据库的正确凭据

<?php
function doDB() {
global $mysqli;
// connect to server and select database; you may need it
$mysqli = mysqli_connect("localhost", "username",
    "password", "db");
    // if connection fails, stop script execution
    if (mysqli_connect_errno()) {
        printf("Connect failed: %s'n", mysqli_connect_error());
        exit();
}
}
function emailChecker($email) {
global $mysqli, $check_res;
//check that email is not already in list
$check_sql = "SELECT id FROM SUBSCRIBERS
    WHERE email = '".$email."'";
$check_res = mysqli_query($mysqli, $check_sql)
    or die(mysqli_error($mysqli));
}
?>

这意味着您的PHP副本没有使用mysqli支持进行编译。这并不意味着你的代码有任何问题,你只是试图使用PHP没有的函数。

有关配置的更多信息,请参阅PHP.net上的Installation-Mysqli。您必须询问您的主机是否可以重建PHP并包括对Mysqli的支持。

安装mysqli扩展