bu2chlc

Untitled

Jan 4th, 2021 (edited)
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. try{
  2. $conn = new PDO("mysql:dbname=somedatabase;host=localhost", "root", "");
  3. $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  4. } catch(PDOException $e){
  5. echo "Connection failed: " . $e->getMessage();
  6. }
  7.  
  8. $date = $_POST["date'];
  9. $name = $_POST["name"];
  10.  
  11. $query = $conn->prepare("select * from table where date=:date and name=:name");
  12. $query->bindParam(":date", $date);
  13. $query->bindParam(":name", $name);
  14. $query->execute();
  15. return $query->rowCount() > 0;
Add Comment
Please, Sign In to add comment