Zend
200-710 · Question #55
QUESTION 58 Consider the following table data and PHP code. What is a possible outcome? Table data (table name "users" with primary key "id"): id name email --- ---- ----- 1 anna [email protected] 2…
Sign in or unlock 200-710 to reveal the answer and full explanation for question #55. The question stem and answer options stay visible for context.
Databases & SQL
Question
QUESTION 58
Consider the following table data and PHP code. What is a possible 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 name, email FROM users LIMIT 1"; $stmt = $pdo->prepare($cmd); $stmt->execute(); $result = $stmt->fetchAll(PDO::FETCH_BOTH); $row = $result[0];
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 name, email FROM users LIMIT 1"; $stmt = $pdo->prepare($cmd); $stmt->execute(); $result = $stmt->fetchAll(PDO::FETCH_BOTH); $row = $result[0];
Options
- AThe value of $row is array(0 => 'anna', 1 => '[email protected]').
- BThe value of $row is array('name' => 'anna', 'email' => '[email protected]').
- CThe value of $row is array(0 => 'anna', 'name' => 'anna', 1 => '[email protected]', 'email' => '[email protected]').
- DThe value of $result is array('anna' => '[email protected]').
Unlock 200-710 to see the answer
You've previewed enough free 200-710 questions. Unlock 200-710 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.
Topics
#PDO#fetchAll#FETCH_BOTH#result sets