Php 插入查询有时不起作用

Php 插入查询有时不起作用,php,mysql,prepared-statement,sql-insert,Php,Mysql,Prepared Statement,Sql Insert,要插入数据库的PHP代码。代码有时不起作用。大多数情况下,它确实有效 <?php include 'connection.php'; if (isset($_POST['docsignup'])) { // prepare and bind $stmt = $link->prepare("INSERT INTO doctor_details(firstname, lastname, license_num, zip_code

要插入数据库的PHP代码。代码有时不起作用。大多数情况下,它确实有效

<?php
    include 'connection.php';
    if (isset($_POST['docsignup']))
     {

        // prepare and bind
        $stmt = $link->prepare("INSERT INTO doctor_details(firstname, lastname, license_num, zip_code, city, state, email, password, speciality) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
        $stmt->bind_param("ssissssss", $docfname, $doclname, $docid, $doczipcode, $city, $state, $docemail, $hash, $speciality);

        // set parameters and execute
        $docfname = $_POST['docfname']; 
        $doclname = $_POST['doclname']; 
        $docemail = $_POST['docemail']; 
        $docloginpassword = $_POST['docloginpassword']; 
        $docid = $_POST['docId']; 
        $speciality = $_POST['speciality']; 
        $city = $_POST['city']; 
        $state = $_POST['state']; 
        $doczipcode = $_POST['doczipcode']; 

        // A higher "cost" is more secure but consumes more processing power
        $cost = 10;

        // Create a random salt
        $salt = strtr(base64_encode(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM)), '+', '.');

        // Prefix information about the hash so PHP knows how to verify it later.
        // "$2a$" Means we're using the Blowfish algorithm. The following two digits are the cost parameter.
        $salt = sprintf("$2a$%02d$", $cost) . $salt;

        // Value:
        // $2a$10$eImiTXuWVxfM37uY4JANjQ==

        // Hash the password with the salt
        $hash = crypt($docloginpassword, $salt);    

        $stmt->execute();

        echo "New records created successfully";

        $stmt->close();
        $link->close();

     }
    ?>

不要区分大小写。让用户键入他/她想要的内容,但在后台您可以将其转换为大写或小写

密码以不可读的格式存储在数据库中,因此它不会对大小写产生任何影响

使用php
strtolower()
将密码转换为小写,并将其存储在数据库中


重新登录时,请执行上述操作。

用户名和密码区分大小写。@MarcoMura该评论没有帮助。。当密码包含大写字母时,为什么不将其插入数据库。将密码存储为小写或大写。我们不能将大写和小写混合使用吗?不要区分大小写。让用户键入他/她想要的内容,但在后台您可以将其转换为大写或小写。
<?php
$link = mysqli_connect("localhost","root","","cl10-doctor");
?>