Skip to content

Latest commit

 

History

History
32 lines (25 loc) · 943 Bytes

0629.md

File metadata and controls

32 lines (25 loc) · 943 Bytes

Consider the following code snippet:

$query = "SELECT first, last, phone
          FROM contacts
          WHERE first LIKE 'John%'";

$statement = mysqli_prepare($link, $query);
mysqli_execute($statement);

/* ???? */

while (($result = mysqli_stmt_fetch($statement))) {
    print "Name: $first $last\n";
    print "Phone: $phone\n\n";
}

Assuming this code snippet is part of a larger correct application, what must be done in place of the ???? above for the correct output to be displayed?

  • A) A while loop, fetching the row and assigning $first, $last, and $phone the proper value
  • B) None of the above
  • C) mysqli_fetch_columns($first, $last, $phone);
  • D) mysqli_stmt_bind_result($statement, $first, $last, $phone);
Answer

Answer: A