PHP mysqli_data_seek() Function
-- Learning not just technology, but dreams!
- Home
- HTML
- JavaScript
- CSS
- Vue
- React
- Python3
- Java
- C
- C++
- C#
- AI
- Go
- SQL
- Linux
- VS Code
- Bootstrap
- Git
- Local Bookmarks
PHP Tutorial
PHP Tutorial PHP Introduction PHP Installation PHP Syntax PHP Variables PHP echo/print Statement PHP EOF(heredoc) Usage PHP Data Types PHP Type Comparison PHP Constants PHP String Variables PHP Operators PHP Ifβ¦Else Statement PHP Switch Statement PHP Arrays PHP Array Sorting PHP Superglobals PHP While Loop PHP For Loop PHP Functions PHP Magic Constants PHP Namespaces PHP OOP PHP Quiz
PHP Forms
PHP Forms PHP Form Validation PHP Form - Required Fields PHP Form - Validate Email and URL PHP Complete Form Example PHP $_GET Variable PHP $_POST Variable
PHP Advanced Tutorial
PHP Multidimensional Arrays PHP Date PHP Includes PHP Files PHP File Upload PHP Cookie PHP Session PHP E-mail PHP Secure E-mail PHP Error PHP Exception PHP Filters PHP Advanced Filters PHP JSON
PHP 7 New Features
PHP Database
PHP MySQL Introduction PHP MySQL Connection PHP MySQL Create Database PHP MySQL Create Table PHP MySQL Insert Data PHP MySQL Insert Multiple Data PHP MySQL Prepared Statements PHP MySQL Read Data PHP MySQL Where PHP MySQL Order By PHP MySQL Update PHP MySQL Delete PHP ODBC
PHP XML
XML Expat Parser XML DOM XML SimpleXML
PHP and AJAX
AJAX Introduction AJAX PHP AJAX Database AJAX XML AJAX Live Search AJAX RSS Reader AJAX Poll
PHP Reference Manual
PHP Array PHP Calendar PHP cURL PHP Date PHP Directory PHP Error PHP Filesystem PHP Filter PHP FTP PHP HTTP PHP Libxml PHP Mail PHP Math PHP Misc PHP MySQLi PHP PDO PHP SimpleXML PHP String PHP XML PHP Zip PHP Timezones PHP Image Processing PHP RESTful PHP PCRE PHP Available Functions PHP Composer
PHP mysqli_data_seek() Function
Find the data in row number 3 in the result set:
// Assume database username: root, password: 123456, database:
$con=mysqli_connect("localhost","root","123456","");
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql="SELECT name,url FROM websites ORDER BY alexa";
if ($result=mysqli_query($con,$sql))
{
// Find data in row number 3
mysqli_data_seek($result,2);
// Read data
$row=mysqli_fetch_row($result);
printf ("name: %s url: %sn", $row, $row);
// Free result set
mysqli_free_result($result);
}
mysqli_close($con);
?>
Definition and Usage
The mysqli_data_seek() function adjusts the result pointer to an arbitrary row in the result set.
Syntax
mysqli_data_seek(result,offset);
| Parameter | Description |
|---|---|
| result | Required. Specifies the result set identifier returned by mysqli_query(), mysqli_store_result(), or mysqli_use_result(). |
| offset | Required. Specifies the field offset. The range must be between 0 and the total number of rows - 1. |
Technical Details
| Return Value: | Returns TRUE on success or FALSE on failure. |
|---|---|
| PHP Version: | 5+ |
YouTip