php页面未发送JSON响应

时间:2019-07-30 20:24:17

标签: php

“”“我制作了一些PHP页面,这些页面控制mysql数据库通过android app使用它 当用户在不良网络中使用应用程序时,当记录重复时,我在页面中遇到了将数据插入数据库的问题。因此,我增加了一个条件来检查该记录是否存在,在插入语句之前,解决了重复问题,但页面未发送成功插入的响应,这在添加重复检查之前运行良好。


    $check1 = mysqli_query($con,"SELECT * FROM ".$tablefault." WHERE username = '$username' AND shiftName = '$shiftname' AND  machineNumber = '$machineNo' AND date = '$dat' AND time = '$time', fault = '$fault' AND action = '$action' AND fixed = '$fixed' AND equiptype = '$equiptype' ");


    if ($check1->num_rows == 0) {

    $sql1="INSERT INTO ". $tablefault ." (userName, shiftName,  machineNumber, date, time, fault, action, fixed, equiptype) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
    $statement = $con->prepare($sql1);

    $statement->bind_param('sssssssss', $username, $shiftname, $machineNo, $dat, $time, $fault, $action, $fixed, $equiptype);

    $statement->execute();

    $statement->close();  

    }


    $con->close();


    $response["success"] = true;
    echo json_encode($response);


0 个答案:

没有答案