diff --git a/reference/mysqli/mysqli_stmt/get-result.xml b/reference/mysqli/mysqli_stmt/get-result.xml index dd27572d99..51e46486e6 100644 --- a/reference/mysqli/mysqli_stmt/get-result.xml +++ b/reference/mysqli/mysqli_stmt/get-result.xml @@ -4,7 +4,7 @@ mysqli_stmt::get_result mysqli_stmt_get_result - Gets a result set from a prepared statement + Gets a result set from a prepared statement as a mysqli_result object @@ -20,13 +20,23 @@ mysqli_stmtstatement - Call to return a result set from a prepared statement query. + Retrieves a result set from a prepared statement as a + mysqli_result object. The data will be fetched from + the MySQL server to PHP. This method should be called only for + queries which produce a result set. &mysqli.available.mysqlnd; + + + This function cannot be used together + with mysqli_stmt_store_result. Both of these functions + retrieve the full result set from the MySQL server. + + @@ -56,46 +66,28 @@ &style.oop; connect_error) -{ - die("$mysqli->connect_errno: $mysqli->connect_error"); -} +mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); +$mysqli = new mysqli("localhost", "my_user", "my_password", "world"); $query = "SELECT Name, Population, Continent FROM Country WHERE Continent=? ORDER BY Name LIMIT 1"; -$stmt = $mysqli->stmt_init(); -if(!$stmt->prepare($query)) -{ - print "Failed to prepare statement\n"; -} -else -{ - $stmt->bind_param("s", $continent); +$stmt = $mysqli->prepare($query); +$stmt->bind_param("s", $continent); - $continent_array = array('Europe','Africa','Asia','North America'); +$continentList = array('Europe', 'Africa', 'Asia', 'North America'); - foreach($continent_array as $continent) - { - $stmt->execute(); - $result = $stmt->get_result(); - while ($row = $result->fetch_array(MYSQLI_NUM)) - { - foreach ($row as $r) - { - print "$r "; - } - print "\n"; +foreach ($continentList as $continent) { + $stmt->execute(); + $result = $stmt->get_result(); + while ($row = $result->fetch_array(MYSQLI_NUM)) { + foreach ($row as $r) { + print "$r "; } + print "\n"; } } - -$stmt->close(); -$mysqli->close(); -?> ]]> @@ -103,51 +95,31 @@ $mysqli->close(); &style.procedural; ]]> - &examples.outputs; + &examples.outputs.similar; mysqli_stmt_fetch mysqli_fetch_array mysqli_stmt_store_result - mysqli_errno