mysqli_query不在表中插入数据

时间:2018-10-20 15:16:58

标签: php mysql sql mysqli insert-into

有人可以找到问题吗? 它不会给出任何错误,但是新行不会出现在数据库中,我也不知道问题是什么。

  if (isset( $_REQUEST['signupnbtn'] ) ) {
    $age = mysqli_real_escape_string($con,$_REQUEST['ageinput']);
    $discord = mysqli_real_escape_string($con,$_REQUEST['discordinput']);
    $email = mysqli_real_escape_string($con,$_REQUEST['emailinput']);
    $tmp = mysqli_real_escape_string($con,$_REQUEST['tmpinput']);
    $steam = mysqli_real_escape_string($con,$_REQUEST['steaminput']);
    $datum = date("d-m-Y");
    $errorcode = 0;

    $q = "INSERT INTO `admissions` (age, discord, email, tmp, steam, datum)
    VALUES ('$age', '$discord', '$email', '$tmp', '$steam', '$datum')";
    $query2 = "SELECT email FROM `admissions` WHERE email='$email'";
    $sql = mysqli_query($con,$query2);
    $countrows = mysqli_num_rows($sql);
    if($countrows >= 1){
      $errorcode = 1;
    }else {
      $result = mysqli_query($con,$q);
    }
      if ($result) {
        $errorcode = 4;
      }

  }

2 个答案:

答案 0 :(得分:0)

t

答案 1 :(得分:0)

问题已解决,日期应采用“ Y-m-d”格式,而不是“ d-m-Y”,如下所示:

private async Task Download(DropboxClient dbx, string folder, string file, string localFilePath)
    {
        using (var response = await dbx.Files.DownloadAsync(folder + "/" + file))
        {
            using (var fileStream = File.Create(localFilePath))
            {
                (await response.GetContentAsStreamAsync()).CopyTo(fileStream);
            }
        }
    }