W3Schools.com

PHP mysql_field_seek() Function


PHP MySQL Reference Complete PHP MySQL Reference

Definition and Usage

The mysql_field_seek() function jumps to a specified field in a recordset.

This function returns TRUE on success, or FALSE and a warning on failure.

Syntax

mysql_field_seek(data,field_offset)

Parameter Description
data Required. Specifies which data pointer to use. The data pointer is the result from the mysql_query() function
field_offset Required. Specifies which field to jump to. 0 indicates the first field


Example

<?php
$con = mysql_connect("localhost", "peter", "abc123");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

$db_selected = mysql_select_db("test_db",$con);

$sql = "SELECT * from Person";
$result = mysql_query($sql,$con);

// Jump to the fourth field
mysql_field_seek($result,3);
print_r(mysql_fetch_field($result));

mysql_close($con);
?>

The output of the code above could be:

stdClass Object
(
[name] => Age
[table] => Person
[def] =>
[max_length] => 2
[not_null] => 0
[primary_key] => 0
[multiple_key] => 0
[unique_key] => 0
[numeric] => 1
[blob] => 0
[type] => int
[unsigned] => 0
[zerofill] => 0
)


PHP MySQL Reference Complete PHP MySQL Reference
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$3.98 Unlimited Hosting
Premium Website Design
WEB BUILDING
Download XML Editor
FREE Website BUILDER
Best Website Templates Top CSS Templates
CREATE HTML Websites
EASY WEBSITE BUILDER
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE