PHP - Function MySQLi Field Seek



Syntax

mysqli_field_seek(result,fieldNumber);

Definition and Usage

This function sets the column cursor to the given column offset.

Return Values

It returns true on success or false on failure

Parameters

Sr.No Parameters & Description
1

result

It identifier the result set

2

fieldNumber

It specifies the column number

Example

Try out the following example

<?php
   $connection_mysql = mysqli_connect("localhost","user","password","db");
   
   if (mysqli_connect_errno($connection_mysql)){
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
   }
   
   $sql = "SELECT name FROM emp";
   
   if ($result = mysqli_query($connection_mysql,$sql)){
      mysqli_field_seek($result,0);
      $fieldinfo = mysqli_fetch_field($result);
      
      print $fieldinfo->name;
      print $fieldinfo->table;
      print $fieldinfo->max_length;
      
      mysqli_free_result($result);
   }
   mysqli_close($connection_mysql);
?>
php_function_reference.htm
Advertisements