I am using a Korn Shell script..
I need to verify the length of a variable..
ie number=12345
I need then to check 12345 to make sure its no longer than 5 digits...
Can you help? (4 Replies)
I'm not familiar with unix.
I need know how to check parameter (length) when i need check the userid. lets say my charaters is 3, how to check I must key-in 3 word before system can continue to another step
echo "\n\n\n\tPlease Enter User ID: \c"
read userid
if
then
echo... (1 Reply)
Hi All,
I have a table with 10 columns. Some columns(2nd,4th,5th,7th,8th and 10th) are Not Null columns. I'll get a tab-delimited file and want to check col by col and generate seperate error code for each col eg:102 if 2nd col value is NULL and 104 if 4th col value is NULL so on... I am a... (7 Replies)
When I try to sort a file where some records contain nulls i.e. hex 00 the sort truncates the record when it reaches the null and writes message:
"sort: warning: missing NEWLINE added at end of input file myfile"
I'm assuming from this that the sort sees the null as a special character and... (6 Replies)
Hi,
I have a problem, please help me,
I have a flat file like this:
P00000000088888888999999999 0000999903 000000000000000000
P00000000077777777000000000 0000999903 000000000000000000
P00000000044444444333333333 0000999903 00000000000000000079875
P00000000066666666111111111 0000999903 ... (5 Replies)
Hi Everyone,
# cat a.txt
a;b;c;64O
a;b;c;d;ee;f
# cat a.pl
#!/usr/bin/perl
use strict;
use warnings;
my $tmp3 = ",,a,,b,,c,,d,,e,,f,,";
open(my $FA, "a.txt") or die "$!";
while(<$FA>) {
chomp;
my @tmp=split(/\;/, $_);
if ( ($tmp =~ m/^(64O)/i) || ($tmp... (3 Replies)
Hi,
I have a issue, I need to loop through a comma delimited file and check for the length which exceeds specified length , if Yes truncate the string.
But my problem is , I do not have to check for all the fields and the field lenght is not same for all the fields.
For ex:
Say my line... (9 Replies)
Discussion started by: rashmisb
9 Replies
LEARN ABOUT PHP
mysql_field_len
MYSQL_FIELD_LEN(3) 1 MYSQL_FIELD_LEN(3)mysql_field_len - Returns the length of the specified fieldSYNOPSIS
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)