mysqli_stmt_data_seek (PHP 5) mysqli_stmt_data_seek (no version information, might be only in CVS) stmt->data_seek -- Seeks to an arbitray row in statement result set DescriptionProcedural style: void mysqli_stmt_data_seek ( mysqli_stmt statement, int offset ) Object oriented style (method): class mysqli_stmt { void data_seek ( int offset ) }
The mysqli_stmt_data_seek() function seeks to an arbitrary result pointer
specified by the offset in the statement result set represented by
statement. The offset parameter must be between
zero and the total number of rows minus one (0..mysqli_stmt_num_rows() - 1).
Return Values
Returns NULL on success or FALSE on failure.
ExamplesExample 1. Object oriented style |
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER BY Name";
if ($stmt = $mysqli->prepare($query)) {
$stmt->execute();
$stmt->bind_result($name, $code);
$stmt->store_result();
$stmt->data_seek(399);
$stmt->fetch();
printf ("City: %s Countrycode: %s\n", $name, $code);
$stmt->close();
}
$mysqli->close();
?>
|
|
Example 2. Procedural style |
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT Name, CountryCode FROM City ORDER BY Name";
if ($stmt = mysqli_prepare($link, $query)) {
mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt, $name, $code);
mysqli_stmt_store_result($stmt);
mysqli_stmt_data_seek($stmt, 399);
mysqli_stmt_fetch($stmt);
printf ("City: %s Countrycode: %s\n", $name, $code);
mysqli_stmt_close($stmt);
}
mysqli_close($link);
?>
|
|
The above example will output: City: Benin City Countrycode: NGA |
add a note
User Contributed Notes
mysqli_stmt_data_seek
There are no user contributed notes for this page.
|
|