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));
}
?>
-
2Have you verified that you have mysqli installed?Matthew Scragg– Matthew Scragg2012年02月20日 22:18:10 +00:00Commented Feb 20, 2012 at 22:18
-
No, haha! Simple, I guess. Thanks.Andy– Andy2012年02月20日 22:19:18 +00:00Commented Feb 20, 2012 at 22:19
2 Answers 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.