PHP mysql_field_len() Function Example

PHP mysql_field_len() Function Example


Posted in : PHP Posted on : February 7, 2011 at 6:16 PM Comments : [ 0 ]

The mysql_field_len() function is used to get the length of the specific field.

PHP mysql_field_len() Function Example:

The mysql_field_len() function is used to get the length of the specific field. The mysql_field_len() function return length of the specified field. It return length on success or false for failure.

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); 
$length = mysql_field_len($result, 2);
echo $length;
}
mysql_close($connection);
?>

In this example we have used mysql_field_len() function that have two parameters first is record set and other is field to start returning.

The database 'user' table fields is:

After running this example the output display by the browser like:

Output:

50

Download Example Code

Go to Topic «PreviousHomeNext»

Your Comment:


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

 
Tutorial Topics