无法使用mysql将数据输入到数据库中

时间:2016-11-12 10:28:52

标签: php mysql

这是将数据输入mysql数据库的php文件。当我运行它时,浏览器显示“已连接成功选择成功执行内部文件未插入”。但它不会显示任何错误。并且数据不会插入到数据库中。这段代码出了什么问题。 * dbConnection.php

CustomNodeModule

* insert.php

  <?php
        $dbhost="localhost";
        $dbuser="root";
        $dbPassword="123";
        $database="medicalcenter";

    $connection = mysqli_connect($dbhost,$dbuser,$dbPassword) or die("unable to connect");
         if($connection){
            echo 'connected successfully ';
        }else{
            echo 'not connected';
        }

        $dbSelect=mysqli_select_db($connection,$database);
        if($dbSelect){
            echo 'selected successfully';
        }else{
            echo 'not selected';
        } 
?>

1 个答案:

答案 0 :(得分:1)

  $sql= "INSERT INTO    patient(FirstName,LastName,AddressLine1,AddressLine2,City,Email,Age,Gender) VALUES ('$firstName','$secondName','$address1','$address2','$city',$email','$age','$gender')";

检查您的上述行,您在发送电子邮件前已忘记',请查看以下行。它可以帮到你。

$sql= "INSERT INTO    patient(FirstName,LastName,AddressLine1,AddressLine2,City,Email,Age,Gender) VALUES ('$firstName','$secondName','$address1','$address2','$city','$email','$age','$gender')";