PHP mysql_field_seek() Function
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
)
|
Complete PHP MySQL Reference
The Altova MissionKit is a suite of intelligent XML tools, including:
XMLSpy® – industry-leading XML editor
- Support for all XML-based technologies
- Graphical editing views, powerful debuggers, code generation, & more
MapForce® – graphical data mapping tool
- Drag-and-drop data conversion with code generation
- Support for XML, DBs, EDI, Excel® 2007, text, Web services
StyleVision® – visual stylesheet designer
- Drag-and-drop stylesheet design for XML & databases
- Output to HTML, PDF, RTF, Word 2007, & more
And more…
Try before you buy with a free fully functional 30-day trial
Download today
|