PDO在执行时返回未知错误消息

I´m developing a website using php and I tried to implement pdo but it keeps returning

PDO::errorInfo():Array([0] => 00000 [1] => [2] => )

It´s very important that I can fix these error since this is an important project for me and I´ve tried everything I could. the connection works fine since I Any ideas? Here is the connection (in case you need it):

<?php 
  $redirect ="503.php";
  $config = parse_ini_file('config.ini');
  $basehost = $config['host'];
  $basecon = $config['table'];
  $seccon = $config['sectable'];
  $basechar = $config['char'];
  $smhost = $config['SMTPhost'];
  $smauth = $config['SMTPAuth'];
  $smuser = $config['SMTPUser'];
  $smpass = $config['SMTPPass'];
  $smsec = $config['SMTPSecure'];
  $cartab = $config['cardtable'];
  $con = "mysql:host=$basehost;dbname=$basecon;charset=$basechar";
  $options = [PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,];
  try {
    $pdo = new PDO($con,$config['username'],$config['password'], $options);
  } catch (Exception $e) {
    exit(header("location:$redirect"));    
  }
?>

Here is the problem I can´t handle:

if($mail->send()) { 
    $stmt = $pdo->prepare("INSERT INTO $basecon.$seccon (C_Nome,C_email,C_User,C_Pass,Card_Number,N_fiscal,D_Nasc,C_Morada,N_tel,N_tel_emer,N_cid,N_saude,Tipo_Sangue,C_Hist,Reg_Code) VALUES (:name, :email,:user,:pass,:cardnum,:fisnum,:birth,:adressnum,:telf,:emertelf,:citcard,:healthcard,:bloodstring,:histstring,:value)");
    $stmt->bindParam(array(':name', $_POST['name']), PDO::PARAM_STR);
    $stmt->bindParam(array(':email', $_POST['email']), PDO::PARAM_STR);
    $stmt->bindParam(array(':user', $_POST['username']), PDO::PARAM_STR);
    $stmt->bindParam(array(':pass', md5($_POST['password'])), PDO::PARAM_STR);
    $stmt->bindParam(array(':cardnum', $_POST['cardnumber']), PDO::PARAM_STR);
    $stmt->bindParam(array(':fisnum', $_POST['fiscalnum']), PDO::PARAM_STR);
    $stmt->bindParam(array(':birth', $_POST['birthdate']), PDO::PARAM_STR);
    $stmt->bindParam(array(':adressnum', $_POST['address']), PDO::PARAM_STR);
    $stmt->bindParam(array(':telf', $_POST['telnum']), PDO::PARAM_STR);
    $stmt->bindParam(array(':emertelf', $_POST['emertelnum']), PDO::PARAM_STR);
    $stmt->bindParam(array(':citcard', $_POST['citnumber']));
    $stmt->bindParam(array(':healthcard', $_POST['healthnumber']), PDO::PARAM_STR);
    $stmt->bindParam(array(':bloodstring', $_POST['bloodtype']), PDO::PARAM_STR);
    $stmt->bindParam(array(':histstring','Conta criada a'), PDO::PARAM_STR);
    $stmt->bindParam(array(':value', $regcode), PDO::PARAM_STR);
    if($stmt->execute()) {
        $successmsg = "Your registration was successful! <a href='login.php'>Clique aqui para efetuar login</a><br>";
    } else {
        $errormsg = "We couldn´t send you the confirmation E-mail, please check if you provided us with the correct E-mail, if so, please try again later.";
    }       
} else {
    echo "
PDO::errorInfo():
";
    print_r($pdo->errorInfo());
    $errormsg = '<div class="alert alert-danger" role="alert">Something went wrong, please try again later." </div>'  ;
}

And the E-mail works so that has nothing to do with the problem. And thank you :)

Your error conditions are in the wrong order. The error is in sending mail, but you display a database error which is, as expected, empty. Proper and consistent indenting will help spot these sorts of problems.

It's also worth noting that you don't need to bind parameters with PDO, and you can use ? placeholders.

One last edit, you enable exceptions during database initialization, but don't use it later in the code. If there's a problem in your database query it won't return false but will throw an exception instead.

if($mail->send()) { 
    try {
        $stmt = $pdo->prepare("INSERT INTO $basecon.$seccon (C_Nome,C_email,C_User,C_Pass,Card_Number,N_fiscal,D_Nasc,C_Morada,N_tel,N_tel_emer,N_cid,N_saude,Tipo_Sangue,C_Hist,Reg_Code) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
        $stmt->execute([
            $_POST['name'],
            $_POST['email'],
            $_POST['username'],
            password_hash($_POST['password']),
            $_POST['cardnumber'],
            $_POST['fiscalnum'],
            $_POST['birthdate'],
            $_POST['address'],
            $_POST['telnum'],
            $_POST['emertelnum'],
            $_POST['citnumber'],
            $_POST['healthnumber'],
            $_POST['bloodtype'],
            'Conta criada a',
            $regcode,
        ]) {
        $successmsg = "Your registration was successful! <a href='login.php'>Clique aqui para efetuar login</a><br>";
    } catch (\Exception $e) {
        // of course you should never catch errors just to display them, this is just a demo
        echo $e->getMessage();
        print_r($pdo->errorInfo());
        $errormsg = '<div class="alert alert-danger" role="alert">Something went wrong, please try again later." </div>';
    }
} else {
    $errormsg = "We couldn´t send you the confirmation E-mail, please check if you provided us with the correct E-mail, if so, please try again later.";
}