0

When submitting the following form I am getting this error :

Fatal error: Call to undefined function mysqli_connect() in .... mailing_list_include.php on line 7

Here's the mailing_list_include.php file - the real thing includes the correct credentials for accessing the db

<?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));
}
?>
2
  • 2
    Have you verified that you have mysqli installed? Commented Feb 20, 2012 at 22:18
  • No, haha! Simple, I guess. Thanks. Commented Feb 20, 2012 at 22:19

2 Answers 2

2

This means your copy of PHP was not compiled with mysqli support. This doesn't mean there is anything wrong with your code, you are simply trying to use a function that PHP does not have available.

See Installation - Mysqli on PHP.net for more information on configuring it. You will have to ask your host if they can rebuild PHP and include mysqli support.

Sign up to request clarification or add additional context in comments.

Comments

2

Installation of the mysqli extension

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.