php用户注册可以';无法连接到数据库

php用户注册可以';无法连接到数据库,php,mysql,database,user-accounts,user-registration,Php,Mysql,Database,User Accounts,User Registration,我在让PHP连接到数据库时遇到问题。这是我第一次使用PHP,我不确定到底出了什么问题,我在互联网上搜索了很多次,却没有找到解决方案。希望你们能帮忙 以下是错误: 致命错误:在第4行的D:\wamp64\www\einsteindesigns\reg.php中找不到类“mysqli\u connect” 以及守则: <?php session_start(); $host = "localhost"; $user = "root"; $pwd = ""; $db = "userdb"; $

我在让PHP连接到数据库时遇到问题。这是我第一次使用PHP,我不确定到底出了什么问题,我在互联网上搜索了很多次,却没有找到解决方案。希望你们能帮忙

以下是错误:

致命错误:在第4行的D:\wamp64\www\einsteindesigns\reg.php中找不到类“mysqli\u connect”

以及守则:

<?php
session_start();
$host = "localhost";
$user = "root";
$pwd = "";
$db = "userdb";

$mysqli = mysqli_connect($host, $user, $pwd, $db);
if(! $mysqli )
{
  die('Could not connect: ' . mysqli_error());
}

if ($_SERVER["REQUEST_METHOD"] == "POST") {

    if ($_POST['password'] == $_POST['confirmpassword']) {

        $first = $_POST['first'];
        $last = $_POST['last'];
        $email = $_POST['email'];
        $password = md5($_POST['password']);
        $confirmpassword = md5($_POST['confirmpassword']);

            $_SESSION['email'] = $email;

               $sql = "INSERT INTO $db (first, last, email, password) "
                      . "VALUES ('$first', '$last', '$email', '$password')";

                    $_SESSION['message'] = "Registration Successful";

                }
                else {
                    $_SESSION['message'] = "Error: User account could not be 
created. Please try again.";
                }
                mysqli_close($mysqli);          
            }
    else {
        $_SESSION['message'] = "Passwords do not match";
    }
?>

在尝试建立连接时会出现什么错误您知道需要在第3-6行($host、$user、$pwd和$db)中填写安装/配置MySQL数据库时设置的信息?如果禁用了错误,请在脚本开头添加以下行:
ini\u set('display\u errors',1);ini设置(“显示启动错误”,1);错误报告(E_全部)第4行没有
mysqli\u connect
。。一旦SQL注入起作用,您也可以接受SQL注入。。。假设将要执行
$sql
,那么安装XAMPP并不是更好的选择。WAMP总是会出现问题。。。!