Name

mysql_field_seek

Synopsis

boolean mysql_field_seek(qresource query, int attribute)

Sets the internal attribute pointer within a result set. The first parameter is a query resource handle returned from a prior call to mysql_query( ) or mysql_unbuffered_query( ). The second argument is the ordinal number of the attribute in the SQL query, where zero refers to the first attribute.

After the attribute pointer has been set using this function, the next call to mysql_fetch_field( ) will return the attribute at this pointer.

The function returns true on success and false on error.

Example

<?php
  $connection = mysql_connect("localhost", "fred", "shhh");
  
  $result = mysql_list_fields("wedding", "presents");
  
  mysql_field_seek($result, 2);
  
  $field = mysql_fetch_field($result);
  
  echo "The third attribute is " . $field->name;
?>

Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.