Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $DB = new PDO($dsn);
- //Why does this work
- $sql = "SELECT column FROM table WHERE id = 5";
- $true = $DB->query($sql);
- if($true) {
- $results = $true->fetch(PDO::FETCH_ASSOC);
- print_r($results); // shows results
- }
- // But this doesn't work...
- $sql = "SELECT column FROM table WHERE id = ?";
- $ids[] = 5;
- $statement = $DB->prepare($sql);
- $true = $statement->execute($ids);
- if($true) {
- $results = $statement->fetch(PDO::FETCH_ASSOC);
- print_r($results); // shows empty
- }
- // :(
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement