Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mysql_field_len(3) [php man page]

MYSQL_FIELD_LEN(3)							 1							MYSQL_FIELD_LEN(3)

mysql_field_len - Returns the length of the specified field

SYNOPSIS
Warning This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include: omysqli_fetch_field_direct(3) [length] o PDOStatement::getColumnMeta [len] int mysql_field_len (resource $result, int $field_offset) DESCRIPTION
mysql_field_len(3) returns the length of the specified field. o $ result -The result resource that is being evaluated. This result comes from a call to mysql_query(3). o $ field_offset -The numerical field offset. The $field_offset starts at 0. If $field_offset does not exist, an error of level E_WARNING is also issued. The length of the specified field index on success or FALSE on failure. Example #1 mysql_field_len(3) example <?php $result = mysql_query("SELECT id,email FROM people WHERE id = '42'"); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } // Will get the length of the id field as specified in the database // schema. $length = mysql_field_len($result, 0); echo $length; ?> Note For backward compatibility, the following deprecated alias may be used: mysql_fieldlen(3) mysql_fetch_lengths(3), strlen(3). PHP Documentation Group MYSQL_FIELD_LEN(3)

Check Out this Related Man Page

MYSQL_FIELD_TABLE(3)							 1						      MYSQL_FIELD_TABLE(3)

mysql_field_table - Get name of the table the specified field is in

SYNOPSIS
Warning This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include: omysqli_fetch_field_direct(3) [table] or [orgtable] o PDOStatement::getColumnMeta [table] string mysql_field_table (resource $result, int $field_offset) DESCRIPTION
Returns the name of the table that the specified field is in. o $ result -The result resource that is being evaluated. This result comes from a call to mysql_query(3). o $ field_offset -The numerical field offset. The $field_offset starts at 0. If $field_offset does not exist, an error of level E_WARNING is also issued. The name of the table on success. Example #1 A mysql_field_table(3) example <?php $query = "SELECT account.*, country.* FROM account, country WHERE country.name = 'Portugal' AND account.country_id = country.id"; // get the result from the DB $result = mysql_query($query); // Lists the table name and then the field name for ($i = 0; $i < mysql_num_fields($result); ++$i) { $table = mysql_field_table($result, $i); $field = mysql_field_name($result, $i); echo "$table: $field "; } ?> Note For backward compatibility, the following deprecated alias may be used: mysql_fieldtable(3) mysql_list_tables(3). PHP Documentation Group MYSQL_FIELD_TABLE(3)
Man Page

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File length

I need to be able to get the length of a specific file. If the file length <> 0, then I need to email it to an address. I tried this: if then (cat $DSDIR/non_reporting_stores.txt) | mail -s "Daily Non Reporting Stores" xyz@xysz.com fi which gave me a syntax error that it could not... (1 Reply)
Discussion started by: poste_d_ordure
1 Replies

2. Post Here to Contact Site Administrators and Moderators

UNIX for Dummyes

Hi guys ! I can't access the UNIX for Dummyes. I get this error: I tried with diferent browsers from 3 diferent locations and I still get into that section. Any ideeas ? (0 Replies)
Discussion started by: Sergiu-IT
0 Replies

3. UNIX for Advanced & Expert Users

length function

Hi,:cool: can any body tell me what is the function to get the length of a string in unix?I have used functions like len,length,strlen, but they are not working. cheers RRK (3 Replies)
Discussion started by: ravi raj kumar
3 Replies

4. Shell Programming and Scripting

replacing a nul field with text

Ok here's my pickle. I have a file in which every line must be the same length. Each field within the line is a certain length. None of these can be changed. What I need to do is look at a specific field within this file, let's say it starts with character 30 and ends with 50. If this field is... (3 Replies)
Discussion started by: DarkHound
3 Replies

5. Shell Programming and Scripting

include NULLs in line length check

Hello, I am checking the length of each line of a fixed length file and making sure all lines are 161 length. My problem is that some files contain null characters which gets stripped out of my echo. How do I have the NULLs included in my check? (and I cannot replace or sub the NULL values with... (10 Replies)
Discussion started by: ironmix
10 Replies

6. Shell Programming and Scripting

echo field separator

I am trying to echo all fields except for the last field. I want to include the field seperator, but it is removed. echo "a;s;v;g" | awk -F ";" '{$(NF--)=""; print}' a s v I want an output like this: a;s;v; (3 Replies)
Discussion started by: locoroco
3 Replies

7. Shell Programming and Scripting

Replace a field with a character as per the field length

Hi all, I have a requirement to replace a field with a character as per the length of the field. Suppose i have a file where second field is of 20 character length. I want to replace second field with 20 stars (*). like ******************** As the field is not a fixed one, i want to do the... (2 Replies)
Discussion started by: gani_85
2 Replies