$token = $_GET["token"]; $stmt = $pdo->prepare("SELECT token FROM Tokens WHERE token =? LIMIT 1"); $stmt->execute(array($token)); echo $stmt->fetchColumn(PDO::FETCH_ASSOC); 

The response from the server is empty. What could be the problem?

  • @Doofy there is no error, the fact of the matter) How to correct my mistake? - Martinez Toni
  • in a token, for example, this: "asdadasdadas" - Martinez Toni
  • @Doofy if it gets into a token, the value of which is in the database, then it gives it out, if there is no such value in the database, the answer is empty) And I always have an empty reason) - Martinez Toni
  • @Doofy changed the way you said, similarly, the answer is empty) - Martinez Toni
  • @Doofy do not mislead a person, it is the array of parameters that is passed to execute . php.net/manual/ru/pdostatement.execute.php - Blacknife

1 answer 1

 $token = $_GET["token"]; $stmt = $pdo->prepare("SELECT token FROM Tokens WHERE token =? LIMIT 1"); $stmt->execute(array($token)); if($stmt->rowCount() == 1) { echo $stmt->fetchColumn(0); }