Oracle 5.0 Reference Manual page 2284

Table of Contents

Advertisement

Description
object mysql_fetch_field(
resource result,
int field_offset
=
=0);
Returns an object containing field information. This function can be used to obtain information about
fields in the provided query result.
Parameters
result
field_offset
Return Values
Returns an object containing field information. The properties of the object are:
• name - column name
• table - name of the table the column belongs to, which is the alias name if one is defined
• max_length - maximum length of the column
• not_null - 1 if the column cannot be
• primary_key - 1 if the column is a primary key
• unique_key - 1 if the column is a unique key
• multiple_key - 1 if the column is a non-unique key
• numeric - 1 if the column is numeric
• blob - 1 if the column is a BLOB
• type - the type of the column
• unsigned - 1 if the column is unsigned
• zerofill - 1 if the column is zero-filled
Examples
Example 20.43.
mysql_fetch_field
<?php
$conn = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$conn) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db('database');
$result = mysql_query('select * from table');
if (!$result) {
die('Query failed: ' . mysql_error());
}
/* get column metadata */
$i = 0;
while ($i < mysql_num_fields($result)) {
echo "Information for column $i:<br />\n";
Original MySQL API (Mysql)
The result resource that is being evaluated. This result comes from
a call to mysql_query.
The numerical field offset. If the field offset is not specified, the next
field that was not yet retrieved by this function is retrieved. The
starts at 0.
field_offset
NULL
example
2264

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents