Câu 55: 200-550: Zend Certified PHP Engineer
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 co…
Nội dung câu hỏi
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];
Các lựa chọn
Đáp án được giữ gọn theo nhãn A, B, C, D trong phần bình chọn tương tác.
- A. The value of $row is `array(0 => 'anna', 1 => '[email protected]')`.
- B. The value of $row is `array('name' => 'anna', 'email' => '[email protected]')`.
- C. The value of $row is `array(0 => 'anna', 'name' => 'anna', 1 => '[email protected]', 'email' => '[email protected]')`. — đáp án hiện tại
- D. The value of $result is `array('anna' => '[email protected]')`.
Cộng đồng
0 bình luận công khai. Tên thành viên được ẩn một phần.