PHP MySql第二个查询未执行

时间:2018-12-04 11:35:51

标签: php mysql

我不知道我的代码有什么问题。已经工作了32小时。我真的很累,可以得到一些帮助。我的页面没有任何错误。 $sql2只是不执行。请协助

<?php

$server = "Localhost";
$user_name = "Root";
$password = "";
$database = "Profiles";

$conn = new mysqli($server, $user_name, $password, $database);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
//This is a UID i get from page url
$_RUID = "";

if(empty($_GET["RUID"])) {
$_RUID = "";
}else{
  $_RUID = $_GET["RUID"];
}

$sql = "SELECT * FROM Read WHERE UID = '" . $_GET["RUID"] . "';";
$result = $conn->query($sql);

  if ($result->num_rows > 0) {

      while($row = mysqli_fetch_array( $result )) {

      $Input_ID = $row[0];
      $Input_UID = $row[1];
      $Input_Branch_UID = $row[2];
      $Input_Alias = $row[3];
      $Input_Door_UID= $row[4];
      $Input_Door_Group_UID = $row[5];
      $Input_Type = $row[6];
      $Input_Area_To = $row[7];
      $Input_Allowed_Areas = $row[8];
      $Input_Current_Area = $row[9];
      $Input_Force_APB = $row[10];
      $Input_Device_Code = $row[11];
      $Input_Output_UID = $row[12];
      $Input_Reader_Port = $row[13];
      $Input_Reader_Name = $row[14];
      $Input_REST_Timeout = $row[15];
      $Input_Last_Scan = $row[16];
      $Input_Updated = $row[17];
      $Input_Enroll = $row[18];
      $Input_Enroll_Event = $row[19];
      $Input_Enroll_Event_Int = $row[20];
      $Input_Time_Attendance_Reader = $row[21];
      $Input_Visitor_Exit = $row[22];
      $Input_Visitor_Require_Host = $row[23];
      $Input_Dropbox = $row[24];
      $Input_Dropbox_Output_UID = $row[25];
      $Input_Dropbox_Input_Port = $row[26];
      $Input_Arming = $row[27];
      $Input_Unarmed_Event = $row[28];
      $Input_Backup = $row[29];

      }
  }

  $toDoList = "+" . $Input_Branch_UID  . "~" . $Input_Alias . "~" . $Input_Door_UID . "~" .
              $Input_Door_Group_UID . "~" . $Input_Type . "~" . $Input_Area_To . "~" . $Input_Allowed_Areas . "~" .
              $Input_Current_Area . "~" . $Input_Force_APB . "~" . $Input_Device_Code . "~" . $Input_Output_UID . "~" .
              $Input_Reader_Port . "~" . $Input_Reader_Name . "~" . $Input_REST_Timeout . "~" . $Input_Last_Scan . "~" .
              $Input_Updated . "~" . $Input_Enroll . "~" . $Input_Enroll_Event . "~" . $Input_Enroll_Event_Int . "~" .
              $Input_Time_Attendance_Reader . "~" . $Input_Visitor_Exit . "~" . $Input_Visitor_Require_Host . "~" .
              $Input_Dropbox . "~" . $Input_Dropbox_Output_UID . "~" . $Input_Dropbox_Input_Port . "~" .
              $Input_Arming . "~" . $Input_Unarmed_Event . "~" . $Input_Backup;

  $UID = substr(uniqid(),0,13);
  $CreateDate = date("Y-m-d H:m:s");

$sql2 = "INSERT INTO `Reader_Todo_List` (UID, Reader_Device, Page, API_Version, Field, Data, Created_DT, Sent, Sent_DT) VALUES ('$UID','$Input_UID','Ping.php','2.0*2.1','Reader','$toDoList','$CreateDate','0','');";
$result2 = $conn->query($sql2);

if ($conn->query($sql2) == "TRUE"){
  echo "UPDATED MYSELF";
}
?>

0 个答案:

没有答案