HTTP错误500 Mysql

时间:2018-08-01 21:37:05

标签: php html http mysqli

每次我添加此代码时,我的页面都会出现HTTP错误500,但是为什么呢? 该代码在另一页上有效。有效页面和无效页面之间的唯一区别是,我在无法正常使用的页面上将UserSpice用作cms系统

$conn = mysqli_connect(*, *, *, *);
if (!$conn) {
    die('Could not connect: ' . mysqli_connect_error());
}
$id=$user->data()->id;

$sql = "SELECT * FROM users WHERE id='$id'";

$check=mysqli_query($conn, $sql);

if (!$check) {
    printf("Error: %s\n", mysqli_error($conn));
    exit();
}

$row = mysqli_fetch_array($check, MYSQLI_ASSOC);

if(isset($_POST['submit'])) {

    $dname = $_POST['dname'];
    $time = $_POST['time'];
    $dnumber = $_POST['dnumber'];
    $dprice = $_POST['dprice'];
    $dabout = $_POST['dabout'];
    $uploaded_file = $_POST['uploaded_file'];


    $id= $conn->real_escape_string($id);
    $dname= $conn->real_escape_string($dname);
    $time= $conn->real_escape_string($time);
    $dnumber= $conn->real_escape_string($dnumber);
    $dprice= $conn->real_escape_string($dprice);
    $dabout= $conn->real_escape_string($dabout);
    $uploaded_file= $conn->real_escape_string($uploaded_file);


    $query = "INSERT INTO `settlement` SET `id` = '$id', `dname` = '$dname', `pickup` = '$time', `dishes` = '$dnumber', `dprice` = '$dprice', `text` = '$dabout', `picture` = '$uploaded_file';
    if (mysqli_query($conn, $query)) {
            die();
    }
    else if (mysqli_error($conn)) {
        $msg_error = "Error updating record: " . mysqli_error($conn);

    }
    mysqli_close($conn);
}

0 个答案:

没有答案