PHP: Hypertext Preprocessor (original) (raw)

mysql_field_flags

(PHP 4, PHP 5)

mysql_field_flags — Get the flags associated with the specified field in a result

Description

Parameters

result

The result resource that is being evaluated. This result comes from a call tomysql_query().

field_offset

The numerical field offset. Thefield_offset starts at 0. Iffield_offset does not exist, an error of level**[E_WARNING](errorfunc.constants.php#constant.e-warning)** is also issued.

Return Values

Returns a string of flags associated with the result or [false](reserved.constants.php#constant.false) on failure.

The following flags are reported, if your version of MySQL is current enough to support them: "not_null", "primary_key", "unique_key", "multiple_key", "blob", "unsigned", "zerofill","binary", "enum", "auto_increment" and "timestamp".

Examples

Example #1 A mysql_field_flags() example

`<?php
$result = mysql_query("SELECT id,email FROM people WHERE id = '42'");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
} flags=mysqlfieldflags(flags = mysql_field_flags(flags=mysqlfieldflags(result, 0);

echo

$flags;
print_r(explode(' ', $flags));
?>`

The above example will output something similar to:

not_null primary_key auto_increment Array ( [0] => not_null [1] => primary_key [2] => auto_increment )

Notes

Note:

For backward compatibility, the following deprecated alias may be used: mysql_fieldflags()

See Also

Found A Problem?

There are no user contributed notes for this page.