+ 1
What's the problem?
What's the problem of the following question? ([sth]: marked as blank) $conn = new PDO("[mysql]:host=localhost;dbname=database", $username, $password); $sql = "SELECT * FROM `table` WHERE id = :id"; $stmt = $conn->prepare($sql); $stmt->bind[Value]("id", 1, PDO::PARAM_INT); $stmt->execute(); $result = $[stmt]->fetch([PDO]::FETCH_ASSOC); /** * @param array $result The result to be used */ Always decline due to the community downvotes. Note: Written in PHP.
2 odpowiedzi
+ 2
This line looks like it may have a typo
$sql = "SELECT * FROM `table` WHERE id = :id";
Maybe you want something like this:
$sql = "SELECT * FROM `table` WHERE id = " . $id . ";"
+ 1
@Sam
No, it will bind using bindValue() method.