HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

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

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE