Advertisement
Guest User

Untitled

a guest
Jul 30th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1.  <?php
  2. global $id;
  3.  
  4. var_dump($_POST);
  5.  
  6.     //  if(isset($_POST["id"]))
  7.     // {
  8.     //  $id = json_decode($_POST["id"], true);
  9.     //  //$id = $_POST["id"];
  10.     //  echo "id is " + $id;
  11.     // } else {
  12.     //  echo "not set";
  13.     // }
  14.  
  15. echo $_POST[id];
  16.     echo "<br>";
  17.  
  18. //add connect to db
  19. $servername = "localhost";
  20. $username = "root";
  21. $password = "secret";
  22. $dbname = "test";
  23.  
  24. // Create connection
  25. $conn = new mysqli($servername, $username, $password, $dbname);
  26. // echo "connected";
  27. // echo "<br>";
  28.  
  29. // Check connection
  30. if ($conn->connect_error) {
  31.     die("Connection failed: " . $conn->connect_error);
  32. }
  33.  
  34.  
  35.  
  36.    $sql = "UPDATE `suspects` SET `count`= `count`+ 1 WHERE `img` = '".$id."'";
  37.  
  38.    if(mysql_query($sql)){
  39.      return "success!";
  40.      console.log("success");
  41.    }
  42.    else {
  43.     return "failed!";
  44.     console.log("failed");
  45.   }
  46. $conn->close();
  47. echo "terminated";
  48.   ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement