⇧
vadnica-logo
My Services About the Project Telegram O meni O meni

mysqli_data_seek()

The mysqli_data_seek() function adjusts the result pointer to an arbitrary row in the result set. What is a pointer? Imagine that the data in the database are like lines in a book. When we execute a query, PHP "takes note of the page" where it left off. Each time we call a read function (fetch), PHP reads the row, and the invisible bookmark (pointer) moves to the next row. When we reach the end, the pointer has nothing left to show and returns an empty value.

EXAMPLE
RESULT
The result will be displayed here...

Practical use: We use this function when we do not want to read rows in sequential order, but instead want to jump directly to a specific record (e.g., to the fifth row). Test it at home like this: