PHP mysqli_field_seek() Function

PHP mysqli_field_seek() function sets the result pointer to a specified field offset.

Syntax

int mysqli_field_seek(connection);

mysqli_field_seek() Function Parameter

ParameterDescription
Connection :Required parameter. The MySQL connection to be used

mysqli_field_seek() Function Return Value

Return Values :Returns an integer that represents the number of fields or columns in the result set.

mysqli_field_seek() Function Example

<?php
$con = mysqli_field_seekt("localhost","user","password","db");

if (mysqli_connect_errno())
{
	echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$sql = "SELECT * FROM employee";
$sql_result = mysqli_query($con, $sql);

// Get field info for 2st column ("lname")
mysqli_field_seek($sql_result,1);
$field_info = mysqli_fetch_field($sql_result);
 
echo $field_info->name. " " . $field_info->table;
mysqli_free_result($sql_result);
 
mysqli_close($con);
?>