Zend
200-550 · Question #212
200-550 Question #212: Real Exam Question with Answer & Explanation
The correct answer is D. The value of $result will be '[email protected]'.. See the full explanation below for the reasoning.
Question
Consider the following table data and PHP code. What is the outcome? Table data (table name "users" with primary key "id"): id name email ------- ----------- ------------------- 1 anna [email protected] 2 betty [email protected] 3 clara [email protected] 5 sue [email protected] PHP code (assume the PDO connection is correctly established): $dsn = 'mysql:host=localhost;dbname=exam'; $user = 'username'; $pass = '********'; $pdo = new PDO($dsn, $user, $pass); $cmd = "SELECT * FROM users WHERE id = :id"; $stmt = $pdo->prepare($cmd); $id = 3; $stmt->bindParam('id', $id); $stmt->execute(); $stmt->bindColumn(3, $result); $row = $stmt->fetch(PDO::FETCH_BOUND);
Options
- AThe database will return no rows.
- BThe value of $row will be an array.
- CThe value of $result will be empty.
- DThe value of $result will be '[email protected]'.
Community Discussion
No community discussion yet for this question.