php pdo bindvalue code example
Example: bind method in pdo in php
If we had a value:
$sql = "SELECT * FROM myTable WHERE id = ?";
$stmt = $conn->prepare($sql);
$stmt->bindValue(1,1);
$stmt->execute();
If we had two values:
$sql = "SELECT * FROM myTable WHERE id = ? and name = ?";
$stmt = $conn->prepare($sql);
$stmt->bindValue(1,1);
$stmt->bindValue(2,"alireza");
$stmt->execute();