如何将数据从用户插入数据库?

时间:2019-05-06 08:40:30

标签: php

我正在编写一个将数据插入数据库的代码,该数据库是通过Form1从用户直接插入的。但我在数据库表中看不到该数据?

    php
    include 'includes/dbh.php';
    $id =$_POST["id"];
    $first=$_POST["firstname"];
    $DEP=$_POST["dep"];
    $s=$_POST["sec"]; 
    $g=$_POST["gpa"];
    //echo "Connected Successfully"."<br>";  

    $query1="INSERT INTO student (student_id,name,departement,section,gpa)VALUES('$id','$first','$DEP','$s','$g' );";
    mysqli_query($conn,$query1);
    header("location: ../index.php?signup=success");
    ?>

0 个答案:

没有答案