PHP mysql_field_flags() Function Example

PHP mysql_field_flags() Function Example


Posted in : PHP Posted on : February 7, 2011 at 5:31 PM Comments : [ 0 ]

The mysql_field_flags() function is used to find the flags of a field in a record set.

PHP mysql_field_flags() Function Example:

The mysql_field_flags() function is used to find the flags of a field in a record set. The mysql_field_flags() gets field data from the mysql_query() function. after the get records returns a string on success, or false on failure.

Syntax:

mysql_field_flags(data, field_offset)

Where data is required for specifies which data pointer to use and field_offset required to specifies which field to start returning.

Example:

<?php
$connection
= mysql_connect("localhost","root","root");

if (!$connection) {
die('PHP Mysql database connection could not connect : ' . mysql_error());
}
else{
mysql_select_db
("php_mysql", $connection);
$sql
= "SELECT * from user";
$result
= mysql_query($sql,$connection);
$flags
= mysql_field_flags($result, 0);
echo $flags
;
}
mysql_close
($connection);
?>

In this example we have start field_offset by 0.

After running this example the flags of the first fields will shows in output.

Output:

not_null primary_key auto_increment

Download Example Code

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics